Solved

CComboBox size

Posted on 2002-05-31
8
1,065 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
xyBalance chalenge 58 88
Define unique primary key 9 89
centeredAverage challenge 8 132
sum13 challenge 24 90
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

862 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

24 Experts available now in Live!

Get 1:1 Help Now