?
Solved

CComboBox size

Posted on 2002-05-31
8
Medium Priority
?
1,112 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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 (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

741 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