How to decrease size of combo box ?

I have CListCtrl placed on dialog.
For editing subitems I have used CComboBox of type dropdown and this 
CComboBox is placed on edited cell in time of editing.

Problem is that height of CComboBox rectangle which is created in resource 
editor is more than my CListCtrl item height.
How to decrease height of CComboBox ?
(Not height of items in ComboBox drop down list but height of CComboBox 
which is not active)

Peter   
0
Peter2031 (452)
8/20/2008 9:30:01 AM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
1273 Views

Similar Articles

[PageSpeed] 5

I'm not sure exactly what you are asking, but if you are resizing the 
control when you overlay it on the list control you could use MoveWindow() 
and get the size of the cell to determine the size of the control that is 
supposed to fit there or you could just create it in the right place and the 
right size as in the article below.  Since users can resize columns (if you 
let them that is) you would want to resize your control appropriately when 
that happens.

If you are just trying to resize the control in the resource editor you can 
click on the outside box of the control to resize horizontally, or click on 
the down arrow to resize the drop down list size.

This article is a little dated so the sample code may not compile without 
some conversion, but the steps listed here are good and I think this may be 
what you're trying to do.  In any event, it should help you get started.

http://www.codeguru.com/cpp/controls/listview/editingitemsandsubitem/article.php/c979

Tom

"Peter" <Peter@discussions.microsoft.com> wrote in message 
news:A462822E-160A-419D-A02D-5D744B6F2FD2@microsoft.com...
>I have CListCtrl placed on dialog.
> For editing subitems I have used CComboBox of type dropdown and this
> CComboBox is placed on edited cell in time of editing.
>
> Problem is that height of CComboBox rectangle which is created in resource
> editor is more than my CListCtrl item height.
> How to decrease height of CComboBox ?
> (Not height of items in ComboBox drop down list but height of CComboBox
> which is not active)
>
> Peter 

0
tom.nospam (3240)
8/20/2008 2:08:26 PM
On Aug 20, 5:30=A0am, Peter <Pe...@discussions.microsoft.com> wrote:
> I have CListCtrl placed on dialog.
> For editing subitems I have used CComboBox of type dropdown and this
> CComboBox is placed on edited cell in time of editing.
>
> Problem is that height of CComboBox rectangle which is created in resourc=
e
> editor is more than my CListCtrl item height.
> How to decrease height of CComboBox ?
> (Not height of items in ComboBox drop down list but height of CComboBox
> which is not active)
>
> Peter =A0

You should be able to change it by calling SetWindowPos on the
combobox.

-
Ajay
0
ajaykalra (6842)
8/20/2008 6:58:55 PM
Peter wrote (in news:A462822E-160A-419D-A02D-5D744B6F2FD2@microsoft.com):

> I have CListCtrl placed on dialog.
> For editing subitems I have used CComboBox of type dropdown and this
> CComboBox is placed on edited cell in time of editing�


Use the combobox�s SetItemHeight function, passing -1 as the index:

m_ComboBox.SetItemHeight(-1, 23); //will make the control taller  than usual
m_ComboBox.SetItemHeight(-1, 7);  //will make the control shorter than usual

Just set the height to whatever the height of the items in your list control is.


HTH

-- 
Alec S.
news/alec->synetech/cjb/net




> �
> Problem is that height of CComboBox rectangle which is created in resource
> editor is more than my CListCtrl item height.
> How to decrease height of CComboBox ?
> (Not height of items in ComboBox drop down list but height of CComboBox
> which is not active)


0
Alec
8/21/2008 2:43:56 AM
I presume that the "correct height" is obtained by GetWindowRect on the edit control, and
will not be a hardwired integer.
					joe

On Wed, 20 Aug 2008 22:43:56 -0400, "Alec S." <@> wrote:

>Peter wrote (in news:A462822E-160A-419D-A02D-5D744B6F2FD2@microsoft.com):
>
>> I have CListCtrl placed on dialog.
>> For editing subitems I have used CComboBox of type dropdown and this
>> CComboBox is placed on edited cell in time of editing�
>
>
>Use the combobox�s SetItemHeight function, passing -1 as the index:
>
>m_ComboBox.SetItemHeight(-1, 23); //will make the control taller  than usual
>m_ComboBox.SetItemHeight(-1, 7);  //will make the control shorter than usual
>
>Just set the height to whatever the height of the items in your list control is.
>
>
>HTH
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
8/21/2008 6:16:35 AM
Joseph M. Newcomer wrote (in news:612qa4d9ju6ad6plfhpj7n0ntir23cc7qr@4ax.com):

> I presume that the "correct height" is obtained by GetWindowRect on the edit
> control, and will not be a hardwired integer.

Oh haha! :P Only in pseudo code as a placeholder. I don�t like splaying open all
the viscera of my code when asking for help; I distill it down to the
essentials.


-- 
Alec S.
news/alec->synetech/cjb/net



> On Wed, 20 Aug 2008 22:43:56 -0400, "Alec S." <@> wrote:
> > Peter wrote (in news:A462822E-160A-419D-A02D-5D744B6F2FD2@microsoft.com):
> >
> > > I have CListCtrl placed on dialog.
> > > For editing subitems I have used CComboBox of type dropdown and this
> > > CComboBox is placed on edited cell in time of editing�
> >
> >
> > Use the combobox�s SetItemHeight function, passing -1 as the index:
> >
> > m_ComboBox.SetItemHeight(-1, 23); //will make the control taller  than usual
> > m_ComboBox.SetItemHeight(-1, 7);  //will make the control shorter than usual
> >
> > Just set the height to whatever the height of the items in your list control
is.


0
Alec
8/21/2008 4:31:19 PM
The problem is that in answering questions to people who can't make the leap from your
condensed code to the actual code they need to write, you end up letting them think that
the "7' is not just a placeholder, but an indication that they should put an integer in
that place.  I actually had a student complain about one of my examples
	if(!finder.IsDirectory())
	    ... file stuff here
               else
                    ... directory stuff here

that there was an error in my example because the "..." wouldn't compile.  Never
underestimate the lack of imagination of your readers...
						joe
On Thu, 21 Aug 2008 12:31:19 -0400, "Alec S." <@> wrote:

>Joseph M. Newcomer wrote (in news:612qa4d9ju6ad6plfhpj7n0ntir23cc7qr@4ax.com):
>
>> I presume that the "correct height" is obtained by GetWindowRect on the edit
>> control, and will not be a hardwired integer.
>
>Oh haha! :P Only in pseudo code as a placeholder. I don�t like splaying open all
>the viscera of my code when asking for help; I distill it down to the
>essentials.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
8/21/2008 7:08:47 PM
Joseph M. Newcomer wrote (in news:f5fra4h8kpmdbge2gfjs8rg0uh33u79umb@4ax.com):

> I actually had a student complain about one of my examples
> if(!finder.IsDirectory())
>     ... file stuff here
>                else
>                     ... directory stuff here
> that there was an error in my example because the "..." wouldn't compile.
> Never underestimate the lack of imagination of your readers...


Fair enough. However I believe that my example was clear enough to remove
confusion for all but the most dense�whom I would imagine would have difficulty
programming anyway.


-- 
Alec S.
news/alec->synetech/cjb/net



> On Thu, 21 Aug 2008 12:31:19 -0400, "Alec S." <@> wrote:
>
> > Joseph M. Newcomer wrote (in
> > news:612qa4d9ju6ad6plfhpj7n0ntir23cc7qr@4ax.com):
> >
> > > I presume that the "correct height" is obtained by GetWindowRect on the
> > > edit control, and will not be a hardwired integer.
> >
> > Oh haha! :P Only in pseudo code as a placeholder. I don�t like splaying
> > open all the viscera of my code when asking for help; I distill it down to
> > the essentials.
>
> The problem is that in answering questions to people who can't make the leap
> from your condensed code to the actual code they need to write, you end up
> letting them think that the "7' is not just a placeholder, but an indication


0
Alec
8/21/2008 7:36:20 PM
Reply:

Similar Artilces:

Key Combo Closes App
I am using a custom keypad which which generates standard keycodes and extended keycodes. I am capturing the key presses in PreTranslateMessage. How can I stop "Alt Shift F4" closing my application? Tim Try processing WM_CLOSE notification message. I think it's the one being sent by Alt+F4. "tim@DELETEMErobotcrazy.com" <tim@robotcrazy.com> wrote in message news:1174078109.910817.11510@d57g2000hsg.googlegroups.com... >I am using a custom keypad which which generates standard keycodes and > extended keycodes. I am capturing the key presses in > Pre...

Adjusting the size of the receipt
is there anyway to remove the spaces in between the items that are printed on the reciept? for example, there is blank paper at the very top before the receipt prints the header information, then there is a one blank like of space before the items sold information is displayed, then there is the blank space again then the amount tendered and change is shown, then there is a blank like space again then it shows how much a customer saved then a more space then the footer information then more space at the very bottom of the receipt. i understand because it uses XML variables to print the...

Open A Sub-Form Using A Combo Box
I have a main form, frmEmployee, to record employee detail, one of which is a combo box, Position. I also have a sub-form for each position. Is there any way of changing the sub-form in the main form to match the position selected? Regards Nick To change the sub form try Me.[SubFormControlName].SourceObject = "SubFormName" Using the AfterUpdate event of the ComboBox -- Good Luck BS"D "Nick hfrupn" wrote: > I have a main form, frmEmployee, to record employee detail, one of which is a > combo box, Position. I also have a sub-form for each position. &g...

Error rsp about merged cells being sized ?
I downloaded my cell phone bill in Excel so I could sort as I wanted. When I tried to do a Data/Sort/Col A, I got the following info/error from my Excel assistance. "The operation requires the merged cells to be identically sized" What should I be doing to unlock the cells so they can be sorted? Thanks ! CTRL + a(twice in 2003) to select all cells. Format>Cells>Alignment. Uncheck the "merge cells" option. I would do this on a copy of the sheet. Don't know what your data will look like once the cells are "unmerged". Gord Dibben MS Excel...

Check Box Formatting ??
Hello Everyone. Its me again. Please can you help me with the following. I have a workbook with 13 sheets in it. Name of first sheet is Holidays. The others are named Apr, May, ......... Mar. I would like to place a check box (if this is the right thing to use)on each monthly sheet that would send the value of cell Mar!I48 to Holidays!D13 and Mar!I50 to Holidays!D17 in one operation. If the check box is ticked the values of I48 and I50 should be transfered. If not ticked the value should default to zero. This is to be repeated on Apr, May etc obvioulsy to different cells on the the ...

How do you increase the size of the Junk E-mail Filter list?
I know there is a Registry value you can change to increase the size of the Junk E-mail Filter list used by Exchange Server 2003, but I have not been able to find this info. Is there a Knowledge Base article or can someone help provide details about how I can increase the size of this list? My environment is smail (only a few users), so I am more concerned about how to provide more space in the Junk E-mail Filter list than I am worried about any impact this might have to performance. Thanks for any information that can be provided ... Take care, Dean I am pleased to pass along for...

Help with Dependant list boxes
Hi Im trying to find a way of doing listboxs that are data dependant I have a table with 3 rows of data A , B, C, Course, mode, Start date, Computing, FT, 5-sept-2005, Computing, FT, 30-sept-2005, Computing, PT, 12-sept-2005, Computing, PT, 8-feb-2006,...

Combo Box
Greetings, I had an issue of how to populate my combo box with unique values only, after some research I discovered collections and how they dont allow duplicate values and I could simply skip the error to achieve the results I wanted. However how can I modify the code to sort the values in the collection (Unique) in alphabetical order? I've seen some complex looking loops based on the old bubble sort routines that I wrote many many moons ago, but wondering what other peoples solutions would be? Any assistance would be appreciated. Cheers Rob 'Populate combo box with unique...

How Do I delete a check box.
I was cutting and pasting text to an Excel file and now I have a check box on the spreadsheet. I tried right-clicking around it to select it and tried left clicking around it. How can I select it so I can remove it from the sheet? Thanks for the help!! -- akkrug =?Utf-8?B?YWtrcnVn?= <kenneth.krug@uticanational.com> wrote in news:B4689D71-B565-4A1B-974E-EB1493A46FDC@microsoft.com: > I was cutting and pasting text to an Excel file and now I have a check > box on the spreadsheet. I tried right-clicking around it to select it > and tried left clicking around it. How c...

how do I enter a list in a list box or a combo box
hi i am trying to enter a list of names into either a list box or a combo box but i can not find out how to do it... can anybody help please... On 31/05/2010 11:42 AM, word challenged wrote: > hi i am trying to enter a list of names into either a list box or a combo box > but i can not find out how to do it... can anybody help please... See the following page of Greg Maxey's website: http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm If it's an ActiveX combobox that you haved inserted directly into the document, right click on it and select View Code and use c...

out of the box Great Plain connector
Is there any news of out of the box integration with Great Plains with CRM from Microsoft ? Not yet, we probably need to wait 3 to 6 month for the new connector. Darren Liu, Microosft CRM MVP Crowe http://www.crowecrm.com On Feb 5, 2:32=A0am, "SA" <discussi...@microsoft.com> wrote: > Is there any news of out of the box integration with Great Plains with CRM= > from Microsoft ? There is connector available for MS CRM 3 and GP 9, If you are looking for CRM 4, you can achieve this using Biztalk or your custom development. You have to wait for some time for CRM ...

Sending a captured .dib file to an image box without storing it
I want to use a command button, say "cmdDisplayImage" to display/ transfer a captured image from the ezVidCap1 control to an image or OLE box on the same form such as "PhotoPreview" (not sure which one is possible/best...perhaps someone can help me...I'm new at this.) I really don't want to "save" it first. Then, I want another command button such as "cmdSaveImage" to save the file to a folder (such as \\Server\Database\Images when the user clicks another command button when they have the image they want in the "PhotoPreview" box. R...

Limiting attachment size per user
I have a quick and easy question. If my SMTP virtual server is putting a size limit on outgoing attachments to 4MBs and in Active Directory under Exchange General->Dilivery Restrictions->Outgoing Message Size->Maximin KB-> I give him 10MBs......who wins? And if the gateway always wins, how can I give a user more without making the global change on the Gateway? Thanks, Pete Hey Pete, I think this article pretty well answers your questions: 322679 Set Size Limits for Messages http://support.microsoft.com/?id=322679 Regards, Colby -- Please do not send e-mail directly to t...

Combo Box Issues
I am relatively new to Access: I am trying to do two things: Use 'other' in a combo box list and have it open a text box where someone can enter free text and have the entry be stored under the same heading Have a combo box selection that will continue to open additional combo boxes (up to 4) until somebody selects the 'none' option, then it will move to the next data entry. Any and all help would be appreciated -- I know these are simple questions but I am trying to teach myself!!! "Clubber Land" <Clubber Land@discussions.microsoft.com> wrote in messa...

text box #5
How do I delete an empty text box? Hi David click on the border of it (so it shows little dots instead of little diagonals) and press the delete key. Cheers JulieD "DavidK" <DavidK@discussions.microsoft.com> wrote in message news:61C2D2F4-2F29-4FB0-B10E-A21DDEB72178@microsoft.com... > How do I delete an empty text box? ...

Null in text box
Can anyone see what might be wrong withthis procedure? Private Sub Job_Number_BeforeUpdate(Cancel As Integer) If IsNull(Me.Job_Number) = True Then MsgBox "No Job Number Entered" Cancel = True End If End Sub -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200707/1 "Haggr1 via AccessMonster.com" <u35393@uwe> wrote in news:74fa8171f7137@uwe: > Can anyone see what might be wrong withthis procedure? > > Private Sub Job_Number_BeforeUpdate(Cancel As Integer) > > If IsNull(Me.Job_...

font sizes for To, From, and Subject text boxes
How do you change the font sizes for these 3 textboxes when composing an email? When you set the fonts under Options->Mail Format, only the font in textarea for the message body gets changed. Thanks, Ernest Correct. That's what that setting is for -- to change the message font. If you want to change the font sizes of other elements, you'd have to design a custom form. In some cases, changing the overall Windows font size might also have an effect. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Dev...

font size in comments
Excel 2003 all sp and patches loaded OS: Windows XP Can you change the default font size in comments? Thanks, Will Will From Debra Dalgleish.............. You can change the font size of new comments by changing the settings in your Control Panel. (Instructions for Windows XP) Right-click on the desktop, and choose Properties On the Appearance tab, click Advanced. From the Item dropdown, choose Tooltip Choose a font Size, click OK, click OK (Note: selecting a font type here will not affect the default font used in Excel's comments) Gord Dibben MS Excel MVP On Tue, 9 Jan...

How do I insert a picture within an Excel comment box?
How do I insert a picture within an Excel comment box? There are instructions here: http://www.contextures.com/xlcomments02.html#Picture Roy White wrote: > How do I insert a picture within an Excel comment box? -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html ...

Font Size in Outlook 2003 Too Large
When I open Outlook to compose an email, the font size that is displayed while I'm typing is large, probably at an 18 font size (I am using Word as my editor). When I send the message and then look at it in the sent folder, the font is not enlarged. In the sent folder the font size corresponds to the setting that is shown on the toolbar while I am typing. It seems that the only place that the font is out of whack is on the display. Any suggestions as to how I can correct this? Thanks for your help. You're probably zoomed in. Hold down the CTRL key and roll the wheel o...

Combo boxes and Protection
Hi all! I have a workbook with a number of worksheets with combo boxes. I made sure to set the locked property to false for the combo boxes, but whenever I try to select an item from my combo box I get the following message: The cell or chart you are trying to change is protected or read-only. In the message I am informed to remove protection ... which of course is not what I want to do. Is there a solution to this problem. Thanks. ...

mail merge inside text box.!
hi all! i am working in word2003. i am having a main document with address inside a text box..! while i am trying mailmerge for fields inside the address box i couldn't succeed..! my fields for address are in a seperate xl file.! how can i achieve this..? any hlp.? -via135 I've no idea -- works fine here. Of course I'm using the Mac version of Word, which is the group you've posted to. Things might be different in the Windows versions. I seem to recall something about fields in text boxes not working properly on the Dark Side but you'd do bet...

Unclick Code on Check box command button
I have code written that when the control check box is selected certain cells will highligh. I would like for those same cells to turn white when the check box is unchecked. What code do I need? Thanks! Private Sub CheckBox1_Click() Range("B17:D17").Select With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid .Value = 0 End With End Sub How about checking if the checkbox is checked or not checked <vbg>? Option Explicit Private Sub CheckBox1_Click() With Me.Range("B17:D17").Interior If Me.C...

Exchange mailbox size??
ok, someone must have asked before, sorry if this is double post. With the following specs, what is the max mailbox size recommended? Any comments are greatly appreciated. Thank you! - Windows 2003 SP1 - Exchange 2003 SP2 w/ 25 Users - DL360 3.4G 1 CPU - 4GB RAM - 150GB SCSI U320 mail box size is really up to you. with 25 users odds are you will not max this out for a while. What version of exchange is it standard or enterprise Standard has a 16 GB limit but with SP2 you can change that via a registry entry to 75 GB limit If it is enterprise then you can go pretty big. I usually see...

Font Size
We loaded an anit-virus software on our server - AVG and found a virus. But after removing virus our font size is very small in Dynamics. It had messed up fonts on other programs, but they all corrected after rebooting. I've reloaded Microsoft Dynamics and that didn't work. I've changed the font size on the display properties, which increases fonts everywhere BUT Microsoft Dynamics. Any suggestions? ...