[转][C#]Combobox 行高

namespace System.Windows.Forms
{
    class ComboBoxEx : ComboBox
    {
        public ComboBoxEx()
        {
            DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
            DrawItem += (s, e) =>
            {
                if (e.Index < 0) return;
                e.DrawBackground();
                e.DrawFocusRectangle();
                e.Graphics.DrawString(GetItemText(Items[e.Index]), e.Font, new SolidBrush(e.ForeColor), e.Bounds.X, e.Bounds.Y + 8);
            };
            ItemHeight = 30;
        }
    }
}

代码来自:https://www.cnblogs.com/yimeishui/p/5803920.html

posted on 2018-04-08 14:28  z5337  阅读(935)  评论(0编辑  收藏  举报