Пример #1
0
 protected override void WndProc(ref Message message)
 {
     base.WndProc(ref message);
     switch (message.Msg)
     {
     case Win32.WM_PAINT:
         this.OnPaint(new PaintEventArgs(Graphics.FromHwnd(this.Handle), this.Bounds));
         if (this.UseTheme && this.BorderStyle == BorderStyle.FixedSingle)
         {
             this.themeBorder = true;
             if (this.Multiline)
             {
                 this.BorderStyle = BorderStyle.None;
             }
         }
         if (this.UseTheme && this.themeBorder)
         {
             Graphics  g = this.CreateGraphics();
             Rectangle r = new Rectangle(0, 0, this.ClientSize.Width - 1, this.ClientSize.Height - 1);
             if (this.Multiline)
             {
                 g.DrawRectangle(new Pen(this.BackColor), r);
                 BorderPanel.Attach(this);
             }
             else
             {
                 g.DrawRectangle(new Pen(this.BorderColor), r);
             }
         }
         break;
     }
 }
Пример #2
0
        protected override void WndProc(ref Message message)
        {
            base.WndProc(ref message);
            switch (message.Msg)
            {
            case Win32.WM_KEYUP:
            case Win32.WM_KEYDOWN:
            case Win32.WM_MOUSEWHEEL:
                this.OnPaint(new PaintEventArgs(Graphics.FromHwnd(this.Handle), this.Bounds));
                break;

            case Win32.WM_PAINT:
                this.OnPaint(new PaintEventArgs(Graphics.FromHwnd(this.Handle), this.Bounds));
                if (this.UseTheme && this.BorderStyle == BorderStyle.FixedSingle)
                {
                    this.themeBorder = true;
                    this.BorderStyle = BorderStyle.None;
                }
                if (this.UseTheme && this.themeBorder)
                {
                    BorderPanel.Attach(this);
                }
                break;
            }
        }
Пример #3
0
 protected override void WndProc(ref Message message)
 {
     base.WndProc(ref message);
     switch (message.Msg)
     {
     case Win32.WM_PAINT:
         if (this.UseTheme && this.BorderStyle == BorderStyle.FixedSingle)
         {
             this.themeBorder = true;
             this.BorderStyle = BorderStyle.None;
         }
         if (this.UseTheme && this.themeBorder)
         {
             BorderPanel.Attach(this);
         }
         break;
     }
 }
Пример #4
0
        public static BorderPanel Attach(Control ctrl, Boolean visible)
        {
            BorderPanel panel;

            if (!UseCustomBorder)
            {
                return(null);
            }
            if (ctrl.Tag is BorderPanel)
            {
                panel = ctrl.Tag as BorderPanel;
            }
            else
            {
                panel        = new BorderPanel();
                panel.Parent = ctrl.Parent;
                panel.Tag    = ctrl;
                ctrl.Tag     = panel;
            }
            var b = BorderWidth * 2;
            var s = new Size(ctrl.Width + b, ctrl.Height + b);
            var l = new Point(ctrl.Left - BorderWidth, ctrl.Top - BorderWidth);
            var v = (ctrl.Dock == DockStyle.None) && visible;

            if (!panel.Size.Equals(s))
            {
                panel.Size = s;
            }
            if (!panel.Location.Equals(s))
            {
                panel.Location = l;
            }
            if (!ctrl.Anchor.Equals(ctrl.Anchor))
            {
                panel.Anchor = ctrl.Anchor;
            }
            if (panel.Visible != v)
            {
                panel.Visible = v;
            }
            return(panel);
        }
Пример #5
0
 protected override void WndProc(ref Message message)
 {
     base.WndProc(ref message);
     if (this.DesignMode)
     {
         return;
     }
     switch (message.Msg)
     {
     case Win32.WM_PAINT:
         this.expandDelay.Enabled = true;
         this.OnPaint(new PaintEventArgs(Graphics.FromHwnd(this.Handle), this.Bounds));
         if (this.UseTheme && this.BorderStyle == BorderStyle.FixedSingle)
         {
             this.themeBorder = true;
             this.BorderStyle = BorderStyle.None;
         }
         if (this.UseTheme && this.themeBorder)
         {
             BorderPanel.Attach(this);
         }
         break;
     }
 }