ComboBox ItemHeight 再高一点
1 public static void BindData(this ComboBox box, List<KeyValuePair<long, string>> data) 2 { 3 box.ItemHeight = 18; 4 box.DropDownStyle = ComboBoxStyle.DropDownList; 5 box.DrawMode = DrawMode.OwnerDrawFixed; 6 box.DataSource = data; 7 box.DrawItem += (sender, e) => 8 { 9 if (e.Index < 0) 10 { 11 return; 12 } 13 e.DrawBackground(); 14 e.DrawFocusRectangle(); 15 e.Graphics.DrawString(data[e.Index].Value.ToString(), e.Font, new SolidBrush(e.ForeColor), e.Bounds.X, e.Bounds.Y + 3); 16 }; 17 }
posted on 2017-11-24 18:11 jonney_wang 阅读(1067) 评论(0) 编辑 收藏 举报