0

我想在选择项目后取消对组合框的关注。怎么做?我将 myCombo 的属性设置如下:

myCombo.DrawMode=OwnerDrawFixed 和 myCombo.DropDownStyle=DropDownList

代码如下:

    void SetComboReadOnly(object sender, DrawItemEventArgs e)
    {
        if (e.Index > -1)
        {
            e.DrawBackground();
            e.Graphics.DrawString(((ComboBox)sender).Items[e.Index].ToString(), this.Font, Brushes.Black, e.Bounds);
            e.DrawFocusRectangle();
        }
    }

    void myCombo_DrawItem(object sender, DrawItemEventArgs e)
    {
        SetComboReadOnly(sender, e);
    }
4

0 回答 0