Solved

CComboBox size

Posted on 2002-05-31
8
1,079 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 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