Solved

CComboBox size

Posted on 2002-05-31
8
1,062 Views
Last Modified: 2013-11-20
Hi.

I'd like to know how to modify the height of a combo box
(I mean the height of the edit control, not the height of the list items)

Thank.
0
Comment
Question by:Iraklis
  • 3
  • 2
  • 2
  • +1
8 Comments
 

Expert Comment

by:vpomona
ID: 7047736
The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.

typedef struct _RECT {
  LONG left;
  LONG top;
  LONG right;
  LONG bottom;
} RECT, *PRECT;


EM_GETRECT

The EM_GETRECT message retrieves the formatting rectangle of an edit control. The formatting rectangle is the limiting rectangle into which the control draws the text. The limiting rectangle is independent of the size of the edit-control window. You can send this message to either an edit control or a rich edit control.

0
 

Author Comment

by:Iraklis
ID: 7047763
I don't know how to manage this message .Could you give me a little and more detailed expanation?
0
 

Expert Comment

by:vpomona
ID: 7047846
To send this message, call the SendMessage function with the following parameters.

SendMessage(
  (HWND) hWnd,              // handle to destination window
  EM_SETRECT,               // message to send
  (WPARAM) wParam,          // coordinate type
  (LPARAM) lParam          // new rectangle (LPRECT)
);
0
 
LVL 32

Expert Comment

by:jhance
ID: 7047878
CComboBox is an MFC class.  It has no size.

I suspect you are really meaning the combobox window control that you've added to your dialog in the Dialog Editor tool.

This control has TWO sizes, the normal size and the EXPANDED size.  Each are sized differently in the dialog editor.

1) To size the normal state, just grab the control by any of it's sizing handles and adjust the size.

2) To size the expanded state, click on the "V" (i.e. the down arrow) and then choose one of the expanded resizing handles and adjust the size.

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Expert Comment

by:vpomona
ID: 7047881
I am trying to do something similar but with a button,  this seems to work for me.  Maybe for you too.

GetDlgItem(IDC_CONTROLNAME)-> SetWindowPos( const CWnd* pWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags );


0
 

Author Comment

by:Iraklis
ID: 7048564
To jhance:

CComboBox is derived for CWnd ( a window) therefore has a size and position.

I want to modify the size of the edit control, in other words, the size of the region of the combo box that displays the current selection. You can find some samples of that in MS-Word or MS-Excel.

I regret to say that it seems like CComboBox class did noy handle the mesages to adjust its  size ans its position.


Regards.
0
 
LVL 32

Expert Comment

by:jhance
ID: 7048641
Sorry, but you are incorrect.  CWnd is NOT a window, but rather is also an MFC class.  You can easily have a CWnd that is NOT associated with any window.

Just do:

CWnd *pCWnd = new CWnd;

OK, so where is the window?
0
 
LVL 12

Accepted Solution

by:
migel earned 160 total points
ID: 7048734
Hi!
size of the Edit part of the COMBOBOX depended from the Font size that setted to this control.
so you can create special font and set it to the combo box by WM_SETFONT message (or by SetFont() class method)
also you can define your combobox as ownerdraw and set this height by processing WM_MEASUREITEM message for this control.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now