私が作成したコンボ ボックスはどれも、高さが 12 ダイアログ単位で止まっているようです。ダイアログ ボックス内のコントロールの間隔とサイズに関する Microsoft のガイドラインでは、コンボ ボックスは 14 ダイアログ ユニットの高さにする必要があると規定されています。
メモ帳でリソース ファイルを編集し、リソース エディターを開かずに Visual Studio で再コンパイルしようとしましたが、コンボ ボックスのサイズがまだ正しくありません。
何か案は?
コンボボックスに指定する高さは、開いたときのコンボボックスのサイズを指定します。編集コントロール部分の高さはフォントに基づいています。(または、所有者が描画する場合は、アイテムのサイズに基づきます。)
私の場合、WM_WINDOWPOSCHANGINGメッセージを処理し、WINDOWPOS構造体のcyメンバーを変更しました。これは機能します。
たとえば、OnInitDialog()で、WTL :: CComboBox :: GetComboBoxInfo()を使用してコンボコンポーネントのHWNDとサイズを取得できます。
COMBOBOXINFO cbi = {sizeof COMBOBOXINFO};
CComboBox(GetDlgItem(ID_MYCOMBO)).GetComboBoxInfo(&cbi);
CRect rComboEdit = cbi.rcItem;
// adjust rComboEdit to your needs
CEdit(cbi.hwndItem).MoveWindow(rComboEdit);
Now let's suppose you want to change size of the drop down area (the list that appears when you press the button). Remember that the combo box used to be just an edit box and a list glued together in old times. So we will need to change the total width/height somehow.
One way is to edit the width/height in the RC file directly.
The astonishing thing with the VS dialog editor is that it will by default create a default "drop" area of almost zero pixels. You won't see the list at all!
In the dialog editor, hover your mouse cursor above the drop down button until the mouse cursor becomes the north-south type. Then click and the real bounds will show and you can modify the area.
Example: