如何将ComboBox设置成平面的? Making Standard ComboBox appear flathttp://www.codeproject.com/cs/combobox/ComboBox_appears_flat.asp 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 也可以考虑用自定义控件,重写一个COMBOX组件,现在.NET里自定义控件很方便了! textbox+button+CSS 不知行不行?还有就是用listbox+button 为什么没有现成 的呢! public class FlatComboBox : System.Windows.Forms.ComboBox { private System.Drawing.Color m_BorderColorOut; private System.Drawing.Color m_BorderColorIn; private System.Windows.Forms.ButtonBorderStyle m_BorderColorStyle; public FlatComboBox() { m_BorderColorOut=System.Drawing.SystemColors.ControlDark; m_BorderColorIn=System.Drawing.SystemColors.ControlLight; 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.Drawing.Color BorderColorIn { get { return this.m_BorderColorIn; } set { this.m_BorderColorIn=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) {// if (m.Msg ==515)//m.Msg == 675mouseleave;512mousemove;m.Msg==256keydown;m.Msg ==257keyup;m.Msg ==514leftbuttonup;m.Msg ==513leftbuttondown;m.Msg ==515WM_LBUTTONDBLCLK// {// return;// } if (m.Msg==0xf || m.Msg==0x133) { this.DrawBorder(); } 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(1,1,this.Width-2,this.Height-2),this.m_BorderColorIn,this.m_BorderColorStyle); System.Windows.Forms.ControlPaint.DrawBorder(this.CreateGraphics(),new System.Drawing.Rectangle(0,0,this.Width,this.Height),this.m_BorderColorOut,this.m_BorderColorStyle); } } 求教一个关于C#考试系统的问题 在wpf中怎么使用cookie winfrom 制作安装文件中有一个ocx文件需要注册,如何解决? DataGrid1问题?麻烦大家进来看一下,非常感谢! toobar 各位大哥,有谁在winform中画过表格? 菜鸟问题:什么是并发错误? contextmenu的奇怪问题,click事件丢失 datagridboolcolumn的三态问题? microsoft的示例一般都是web方面 关于一个WinForm的问题请教?在线等! 再次100分求救!我次次都结帐!急!急!高手多帮忙
还有就是用listbox+button 为什么没有现成 的呢!
{
private System.Drawing.Color m_BorderColorOut;
private System.Drawing.Color m_BorderColorIn;
private System.Windows.Forms.ButtonBorderStyle m_BorderColorStyle;
public FlatComboBox()
{
m_BorderColorOut=System.Drawing.SystemColors.ControlDark;
m_BorderColorIn=System.Drawing.SystemColors.ControlLight;
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.Drawing.Color BorderColorIn
{
get
{
return this.m_BorderColorIn;
}
set
{
this.m_BorderColorIn=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)
{
// if (m.Msg ==515)//m.Msg == 675mouseleave;512mousemove;m.Msg==256keydown;m.Msg ==257keyup;m.Msg ==514leftbuttonup;m.Msg ==513leftbuttondown;m.Msg ==515WM_LBUTTONDBLCLK
// {
// return;
// }
if (m.Msg==0xf || m.Msg==0x133)
{
this.DrawBorder();
}
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(1,1,this.Width-2,this.Height-2),this.m_BorderColorIn,this.m_BorderColorStyle);
System.Windows.Forms.ControlPaint.DrawBorder(this.CreateGraphics(),new System.Drawing.Rectangle(0,0,this.Width,this.Height),this.m_BorderColorOut,this.m_BorderColorStyle);
}
}