如何设置combobox边框颜色 刚刚接触C/S项目,请高手给于指点 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用的多的话继承combobox自己用GDI+画边框用的不多的话有两个笨方法:一:将combobox的FlatStyle设为Flat,在上级容器(如Form)的Paint事件里用GDI+按combobox的位置和大小画框框二:放四个label分为将高或宽设为1,背景色设成你想要的,放在combobox四周 public class ComboBoxDraw : ComboBox { private System.Drawing.Color m_BorderColorOut; private System.Windows.Forms.ButtonBorderStyle m_BorderColorStyle; public ComboBoxDraw() { m_BorderColorOut = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(130)))), ((int)(((byte)(180))))); BorderColorStyle = System.Windows.Forms.ButtonBorderStyle.Solid; } public System.Drawing.Color BorderColorOut { get { return this.m_BorderColorOut; } set { this.m_BorderColorOut = value; //在该值发生变化时重绘控件,下同 //在设计模式下,更改该属性时,如果不调用该语句, //则不能立即看到设计试图中该控件相应的变化 this.DrawBorder(); } } public System.Windows.Forms.ButtonBorderStyle BorderColorStyle { get { return this.m_BorderColorStyle; } set { this.m_BorderColorStyle = value; //在该值发生变化时重绘控件,下同 //在设计模式下,更改该属性时,如果不调用该语句, //则不能立即看到设计试图中该控件相应的变化 this.DrawBorder(); } } protected override void WndProc(ref System.Windows.Forms.Message m) { base.WndProc(ref m); //拦截系统消息,获得当前控件进程以便重绘。 if (m.Msg == 0xf || m.Msg == 0x133) { this.DrawBorder(); } } private void DrawBorder() { System.Windows.Forms.ControlPaint.DrawBorder(this.CreateGraphics(), new System.Drawing.Rectangle(0, 0, this.Width, this.Height), this.m_BorderColorOut, this.m_BorderColorStyle); } } C#在后台如何获取页面上html标记? 写入excel操作问题 TreeView 加号问题 (追加问题) 怎样将string转换成decimal 谁会用api系列函数WaveOutXXX呀?我调试十天了。郁闷! C#实现Visio中的动态连接线功能 webBrowser控件使用问题 emf(metafile)输出的矢量图形怎么按比例打印 伤心啊,很笨的问题请教!紧急,求救!!! 各位大虾请问哪有vc#下 载? 麻烦解释一下C#中的构造方法 如何在点击按钮后重启C#做的应用程序?
用的不多的话有两个笨方法:
一:将combobox的FlatStyle设为Flat,在上级容器(如Form)的Paint事件里用GDI+按combobox的位置和大小画框框
二:放四个label分为将高或宽设为1,背景色设成你想要的,放在combobox四周
{
private System.Drawing.Color m_BorderColorOut;
private System.Windows.Forms.ButtonBorderStyle m_BorderColorStyle; public ComboBoxDraw()
{
m_BorderColorOut = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(130)))), ((int)(((byte)(180)))));
BorderColorStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
} public System.Drawing.Color BorderColorOut
{
get
{
return this.m_BorderColorOut;
}
set
{
this.m_BorderColorOut = value;
//在该值发生变化时重绘控件,下同
//在设计模式下,更改该属性时,如果不调用该语句,
//则不能立即看到设计试图中该控件相应的变化
this.DrawBorder();
}
}
public System.Windows.Forms.ButtonBorderStyle BorderColorStyle
{
get
{
return this.m_BorderColorStyle;
}
set
{
this.m_BorderColorStyle = value;
//在该值发生变化时重绘控件,下同
//在设计模式下,更改该属性时,如果不调用该语句,
//则不能立即看到设计试图中该控件相应的变化
this.DrawBorder();
}
}
protected override void WndProc(ref System.Windows.Forms.Message m)
{
base.WndProc(ref m); //拦截系统消息,获得当前控件进程以便重绘。
if (m.Msg == 0xf || m.Msg == 0x133)
{
this.DrawBorder();
}
}
private void DrawBorder()
{
System.Windows.Forms.ControlPaint.DrawBorder(this.CreateGraphics(), new System.Drawing.Rectangle(0, 0, this.Width, this.Height), this.m_BorderColorOut, this.m_BorderColorStyle);
}
}