如何在下拉列表框的列表项前加上图标? see:http://dotnet.aspx.cc/ShowDetail.aspx?id=C81AD80E-FC14-4FF8-85F3-16CC68811BD5 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的是System.Windows.Forms.ComboBox 类windows 资源管理器的实现 private void comboBox_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { Font font=new Font("宋体",8); Pen pen = new Pen(Color.Black); SolidBrush brushFont = new SolidBrush(Color.Black); SolidBrush brushBack = new SolidBrush(Color.White); SolidBrush brushFocus = new SolidBrush(Color.SeaShell); //画背景 Rectangle rect=e.Bounds; rect.Height-=1; if (e.State.ToString().Trim()=="Selected, Focus") { e.Graphics.FillRectangle(brushFocus,rect); } else { e.Graphics.FillRectangle(brushBack,rect); } //画图片 Rectangle rect2=e.Bounds; rect2.Inflate(-1,-1); rect2.Width=rect2.Height+4; if ((e.Index!=-1) && (e.Index!=this.comboBox.Items.Count-1)) e.Graphics.DrawImage(this.m_imageList.Images[e.Index],rect2); //输出文字 if (e.Index!=-1) e.Graphics.DrawString(this.comboBox.Items[e.Index].ToString(),font,brushFont,rect2.Width+8,rect2.Top); } 看看这个21.5 How do I implement an owner drawn combobox?http://www.syncfusion.com/FAQ/WinForms/FAQ_c88c.asp#q547q C#实现窗体绘图 怎样在一个字符串中删除特定字符:和它前面的字符串? c#循环中对象实例的疑问 c#中有没有像VB.NET中的Module的简单定义方式???? C#中的异常 控制台程序响应关闭事件 [源码][原创]C#做的桌面工具 哪位兄弟做过集群 看了一整天的XML,胡涂了 关于windows phone 8.0连接sqlite数据库的问题,跪求大神救命。。。 输入验证的问题,怎么使用户在文本框中只能输入数字? C#可否使用全局钩子技术?我的程序需要热键呼出!
{
Font font=new Font("宋体",8);
Pen pen = new Pen(Color.Black);
SolidBrush brushFont = new SolidBrush(Color.Black);
SolidBrush brushBack = new SolidBrush(Color.White);
SolidBrush brushFocus = new SolidBrush(Color.SeaShell);
//画背景
Rectangle rect=e.Bounds;
rect.Height-=1;
if (e.State.ToString().Trim()=="Selected, Focus")
{
e.Graphics.FillRectangle(brushFocus,rect);
}
else
{
e.Graphics.FillRectangle(brushBack,rect);
} //画图片
Rectangle rect2=e.Bounds;
rect2.Inflate(-1,-1);
rect2.Width=rect2.Height+4; if ((e.Index!=-1) && (e.Index!=this.comboBox.Items.Count-1))
e.Graphics.DrawImage(this.m_imageList.Images[e.Index],rect2); //输出文字
if (e.Index!=-1)
e.Graphics.DrawString(this.comboBox.Items[e.Index].ToString(),font,brushFont,rect2.Width+8,rect2.Top); }
21.5 How do I implement an owner drawn combobox?
http://www.syncfusion.com/FAQ/WinForms/FAQ_c88c.asp#q547q