投稿日 | : 2003/09/03(Wed) 18:32 |
投稿者 | : 花ちゃん |
Eメール | : |
URL | : |
タイトル | : Re: コンボボックス(SampleNo=149)について |
'===== コンテナ上のコンボボックスの場合 =====
Private Sub Combo2_DropDown()
'ドロップダウンリストの表示項目数を12に設定
Call sCBDropDownListItem1(Combo2, 12)
End Sub
Private Sub sCBDropDownListItem1(CBControl As Control, Item As Long)
Dim CBHeight As Long
Dim Result As Long
Dim Ratio As Long
'ピクセルあたりのtwip 数を取得
Ratio = Screen.TwipsPerPixelX
With CBControl
'項目の高さを取得
CBHeight = SendMessage(.hwnd, CB_GETITEMHEIGHT, 0&, ByVal 0&)
'12項目表示する場合の高さを求める
CBHeight = (.Height \ Ratio) + CBHeight * Item + 2
'コンボボックスの高さを変更
Result = MoveWindow(.hwnd, .Left \ Ratio, .Top \ Ratio, .Width \ Ratio, CBHeight, 1&)
End With
End Sub