刚刚接触C/S项目,请高手给于指点

解决方案 »

  1.   

    用的多的话继承combobox自己用GDI+画边框
    用的不多的话有两个笨方法:
    一:将combobox的FlatStyle设为Flat,在上级容器(如Form)的Paint事件里用GDI+按combobox的位置和大小画框框
    二:放四个label分为将高或宽设为1,背景色设成你想要的,放在combobox四周
      

  2.   

    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);
            }
        }