using System.Runtime.InteropServices;private const int CB_SETITEMHEIGHT = 0x153;[DllImport("user32.dll", EntryPoint="SendMessageA")] private static extern int SendMessage (IntPtr hwnd, int wMsg, int wParam, int lParam); MessageBox.Show(SendMessage(this.comboBox1.Handle, CB_SETITEMHEIGHT, -1, 50).ToString()); for(int i = 0; i < 10; i++){ this.comboBox1.Items.Add("hello" + i.ToString());}
this.comboBox1.ItemHeight=50;
private static extern int SendMessage (IntPtr hwnd, int wMsg, int wParam, int lParam);
MessageBox.Show(SendMessage(this.comboBox1.Handle, CB_SETITEMHEIGHT, -1, 50).ToString());
for(int i = 0; i < 10; i++){
this.comboBox1.Items.Add("hello" + i.ToString());}
this.comboBox1.ItemHeight=50;
学习。
this.comboBox1.ItemHeight=50;
设置以后,下拉列表中的item是白色的,很奇怪?