ComboBox行高
作者:互联网
//行高至少大于20 public static void SetComboBoxLineHeight(ComboBox list, int itemHeight) { list.DropDownStyle = ComboBoxStyle.DropDownList; list.ItemHeight = itemHeight; list.DrawMode = DrawMode.OwnerDrawFixed; list.DrawItem += new DrawItemEventHandler(delegate (object sender, DrawItemEventArgs e) { if (e.Index < 0) { return; } e.DrawBackground(); e.DrawFocusRectangle(); e.Graphics.DrawString((list.Items[e.Index] as TbKaiFa).KName.ToString(), e.Font, new SolidBrush(e.ForeColor), e.Bounds.X, e.Bounds.Y + 3); }); }
标签:Index,ComboBox,list,new,DrawMode,行高 来源: https://www.cnblogs.com/212s/p/15796875.html