我想在选择项目后删除对组合框的关注。怎么做?我按如下方式设置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);
}