Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CComboBox size

Posted on 2002-05-31
8
Medium Priority
?
1,130 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 

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 640 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

926 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