Combo Box Height
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 20

Thread: Combo Box Height

  1. #1
    Join Date
    Apr 2009
    Posts
    82

    Combo Box Height

    May I know how to adjust the combo box height?
    I can adjust the combo box width and also the dropdown list height but not the combo box height.
    See attachment combobox.jpg/
    Attached Images Attached Images  

  2. #2
    Join Date
    Apr 2009
    Posts
    82

    Re: Combo Box Height

    I found that the function combo box SetItemHeight(); with the index -1 can set the height of combo box. But after setting the height, I found that the font size still remain the same. How can I change the font size in a combo box?
    Regards,
    PH Chang

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,046

    Re: Combo Box Height

    Quote Originally Posted by PHChang View Post
    I found that the function combo box SetItemHeight(); with the index -1 can set the height of combo box. But after setting the height, I found that the font size still remain the same. How can I change the font size in a combo box?
    You can change the droplist height in the resource editor. Just click the arrow and size it how you want it.

    Use SetFont to change the font.

  4. #4
    Join Date
    Apr 2009
    Posts
    82

    Re: Combo Box Height

    I am using below way to set the font size for combo box. I believe this is the correct way?
    Let me know if have better.

    Code:
            CComboBox cCombo;
    	CFont m_font;
    	LOGFONT lf;
    	lf.lfHeight=30;
    	m_font.CreateFontIndirect(&lf);
    	cCombo.SetFont(&m_font);
    Regards,
    PH Chang

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,046

    Re: Combo Box Height

    Quote Originally Posted by PHChang View Post
    I am using below way to set the font size for combo box. I believe this is the correct way?
    Let me know if have better.

    Code:
            CComboBox cCombo;
    	CFont m_font;
    	LOGFONT lf;
    	lf.lfHeight=30;
    	m_font.CreateFontIndirect(&lf);
    	cCombo.SetFont(&m_font);
    You'd want to use Class Wizard to attach a CComboBox object to your dialog's combo box. cCombo is just a random combo box that has nothing to do with your control. Here's an article talking about a CStatic, but it's the same principle with a CComboxBox.

  6. #6
    Join Date
    Apr 2009
    Posts
    82

    Re: Combo Box Height

    Thanks but where is the article link that you mentioned?

  7. #7
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,046

    Re: Combo Box Height

    Quote Originally Posted by PHChang View Post
    Thanks but where is the article link that you mentioned?
    Sorry.
    http://forums.codeguru.com/showthrea...t-of-a-control

  8. #8
    Join Date
    Apr 2009
    Posts
    82

    Re: Combo Box Height

    OK thanks.
    By the way, is it possible to set the width of vertical scroll bar of a combo box?
    See attached photo scrollboxwidth.jpg.
    Attached Images Attached Images  

  9. #9
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,261

    Re: Combo Box Height

    is it possible to set the width of vertical scroll bar of a combo box?
    Not that I am aware of as the width of a vertical scroll bar is a system-wide defined constant. Use
    Code:
    GetSystemMetrics(SM_CXVSCROLL);
    to obtain the value.

    Why do you want to do this? What you can do is change the width of the drop-down list box to be different to the width of the edit box.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  10. #10
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,922

    Re: Combo Box Height

    There are generally two types of controls in Windows: standard controls and custom controls. Custom controls are pretty customizable by design. Combobox is a standard control, so it's not that easy to change its looks. Well, standard means standard, and you know, I think keeping it looking standard (i.e. following OS's UI/UX guidelines) means you respect your end users first of all.
    Best regards,
    Igor

  11. #11
    Join Date
    Apr 2009
    Posts
    82

    Re: Combo Box Height

    The reason I want to increase the width is because I am using a touch screen monitor so want to create a wider scroll bar so that user easy to click on it.
    Anyway, thanks all for the advise.
    I guess combo box is a standard controls.
    Regards,
    PH Chang

  12. #12
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,261

    Re: Combo Box Height

    if you want to do this, probably the way to do it would be to create your own custom control that looked like the standard control but with a resizeable scroll bar.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  13. #13
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,261

    Re: Combo Box Height

    Ignore.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center