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);
            });
        }

 

上一篇:Qt MVD模型视图代理组件简介


下一篇:【IOS界面布局】横竖屏切换和控件自适应(推荐)