System.Windows.Forms.ControlPaint.DrawBorder(System.Drawing.Graphics, System.Drawing.Rectangle, System.Drawing.Color, int, System.Windows.Forms.ButtonBorderStyle, System.Drawing.Color, int, System.Windows.Forms.ButtonBorderStyle, System.Drawing.Color, int, System.Windows.Forms.ButtonBorderStyle, System.Drawing.Color, int, System.Windows.Forms.ButtonBorderStyle)

Here are the examples of the csharp api class System.Windows.Forms.ControlPaint.DrawBorder(System.Drawing.Graphics, System.Drawing.Rectangle, System.Drawing.Color, int, System.Windows.Forms.ButtonBorderStyle, System.Drawing.Color, int, System.Windows.Forms.ButtonBorderStyle, System.Drawing.Color, int, System.Windows.Forms.ButtonBorderStyle, System.Drawing.Color, int, System.Windows.Forms.ButtonBorderStyle) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

28 Examples 7

1. Example

Project: dockpanelsuite
Source File: InertButton.cs
View license
private void DrawBorder(Graphics g)
        {
            ButtonBorderStyle bs;

            // Decide on the type of border to draw around image
            if (!this.Enabled)
                bs = IsPopup ? ButtonBorderStyle.Outset : ButtonBorderStyle.Solid;
            else if (m_mouseOver && m_mouseCapture)
                bs = ButtonBorderStyle.Inset;
            else if (IsPopup || m_mouseOver)
                bs = ButtonBorderStyle.Outset;
            else
                bs = ButtonBorderStyle.Solid;

            Color colorLeftTop;
            Color colorRightBottom;
            if (bs == ButtonBorderStyle.Solid)
            {
                colorLeftTop = this.BackColor;
                colorRightBottom = this.BackColor;
            }
            else if (bs == ButtonBorderStyle.Outset)
            {
                colorLeftTop = m_borderColor.IsEmpty ? this.BackColor : m_borderColor;
                colorRightBottom = this.BackColor;
            }
            else
            {
                colorLeftTop = this.BackColor;
                colorRightBottom = m_borderColor.IsEmpty ? this.BackColor : m_borderColor;
            }
            ControlPaint.DrawBorder(g, this.ClientRectangle,
                colorLeftTop, m_borderWidth, bs,
                colorLeftTop, m_borderWidth, bs,
                colorRightBottom, m_borderWidth, bs,
                colorRightBottom, m_borderWidth, bs);
        }

2. Example

Project: sharpshell
Source File: ToolStripRenderers.cs
View license
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
        {
            Rectangle rect = e.AffectedBounds;
            Color borderColor = VisualStyleInformation.TextControlBorder;
            int borderWidth = 1;

            ControlPaint.DrawBorder(e.Graphics, rect, borderColor, borderWidth,
                                    ButtonBorderStyle.Solid, borderColor, borderWidth, ButtonBorderStyle.Solid,
                                    borderColor, borderWidth, ButtonBorderStyle.Solid, borderColor,
                                    borderWidth, ButtonBorderStyle.Solid);
        }

3. Example

Project: ArnoldSimulator
Source File: InertButton.cs
View license
private void DrawBorder(Graphics g)
		{
			ButtonBorderStyle bs;

			// Decide on the type of border to draw around image
			if (!this.Enabled)
				bs = IsPopup ? ButtonBorderStyle.Outset : ButtonBorderStyle.Solid;
			else if (m_mouseOver && m_mouseCapture)
				bs = ButtonBorderStyle.Inset;
			else if (IsPopup || m_mouseOver)
				bs = ButtonBorderStyle.Outset;
			else
				bs = ButtonBorderStyle.Solid;

			Color colorLeftTop;
			Color colorRightBottom;
			if (bs == ButtonBorderStyle.Solid)
			{
				colorLeftTop = this.BackColor;
				colorRightBottom = this.BackColor;
			}
			else if (bs == ButtonBorderStyle.Outset)
			{
				colorLeftTop = m_borderColor.IsEmpty ? this.BackColor : m_borderColor;
				colorRightBottom = this.BackColor;
			}
			else
			{
				colorLeftTop = this.BackColor;
				colorRightBottom = m_borderColor.IsEmpty ? this.BackColor : m_borderColor;
			}
			ControlPaint.DrawBorder(g, this.ClientRectangle,
				colorLeftTop, m_borderWidth, bs,
				colorLeftTop, m_borderWidth, bs,
				colorRightBottom, m_borderWidth, bs,
				colorRightBottom, m_borderWidth, bs);
		}

4. Example

Project: MinidumpExplorer
Source File: SummaryView.cs
View license
private void lblSeperator2_Paint(object sender, PaintEventArgs e)
        {
            ControlPaint.DrawBorder(e.Graphics, lblSeperator2.DisplayRectangle, Color.White, ButtonBorderStyle.Solid);
        }

5. Example

Project: Histacom2
Source File: Paintbrush.cs
View license
public static void PaintClassicBorders(object sender, PaintEventArgs e, int borderwidth)
        {
            ControlPaint.DrawBorder(e.Graphics, ((Control)sender).ClientRectangle,
                Color.White, borderwidth, ButtonBorderStyle.Solid,
                Color.White, borderwidth, ButtonBorderStyle.Solid,
                Color.Gray, borderwidth, ButtonBorderStyle.Solid,
                Color.Gray, borderwidth, ButtonBorderStyle.Solid);
        }

6. Example

Project: Histacom2
Source File: Paintbrush.cs
View license
public static void PaintClassicBordersIndented(object sender, PaintEventArgs e, int borderwidth)
        {
            ControlPaint.DrawBorder(e.Graphics, ((Control)sender).ClientRectangle,
                Color.Gray, borderwidth, ButtonBorderStyle.Solid,
                Color.Gray, borderwidth, ButtonBorderStyle.Solid,
                Color.White, borderwidth, ButtonBorderStyle.Solid,
                Color.White, borderwidth, ButtonBorderStyle.Solid);
        }

7. Example

Project: starstructor
Source File: AssetBrowser.cs
View license
private void AssetPreviewLayoutTable_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            Color borderColor = SystemColors.ControlDarkDark;
            int borderWidth = 1;

            ButtonBorderStyle leftBorderStyle = ButtonBorderStyle.None;
            ButtonBorderStyle topBorderStyle = ButtonBorderStyle.None;
            ButtonBorderStyle rightBorderStyle = ButtonBorderStyle.None;
            ButtonBorderStyle bottomBorderStyle = ButtonBorderStyle.None;

            if (e.Row == 1 || e.Row == 2)
            {
                topBorderStyle = ButtonBorderStyle.Dotted;
            }

            ControlPaint.DrawBorder(
                e.Graphics,
                e.CellBounds,
                borderColor,
                borderWidth,
                leftBorderStyle,
                borderColor,
                borderWidth,
                topBorderStyle,
                borderColor,
                borderWidth,
                rightBorderStyle,
                borderColor,
                borderWidth,
                bottomBorderStyle);
        }

8. Example

Project: ynoteclassic
Source File: InertButton.cs
View license
private void DrawBorder(Graphics g)
        {
            ButtonBorderStyle bs;

            // Decide on the type of border to draw around image
            if (!Enabled)
                bs = IsPopup ? ButtonBorderStyle.Outset : ButtonBorderStyle.Solid;
            else if (m_mouseOver && m_mouseCapture)
                bs = ButtonBorderStyle.Inset;
            else if (IsPopup || m_mouseOver)
                bs = ButtonBorderStyle.Outset;
            else
                bs = ButtonBorderStyle.Solid;

            Color colorLeftTop;
            Color colorRightBottom;
            if (bs == ButtonBorderStyle.Solid)
            {
                colorLeftTop = BackColor;
                colorRightBottom = BackColor;
            }
            else if (bs == ButtonBorderStyle.Outset)
            {
                colorLeftTop = m_borderColor.IsEmpty ? BackColor : m_borderColor;
                colorRightBottom = BackColor;
            }
            else
            {
                colorLeftTop = BackColor;
                colorRightBottom = m_borderColor.IsEmpty ? BackColor : m_borderColor;
            }
            ControlPaint.DrawBorder(g, ClientRectangle,
                colorLeftTop, m_borderWidth, bs,
                colorLeftTop, m_borderWidth, bs,
                colorRightBottom, m_borderWidth, bs,
                colorRightBottom, m_borderWidth, bs);
        }

9. Example

Project: SquareOne
Source File: InertButton.cs
View license
private void DrawBorder(Graphics g)
        {
            ButtonBorderStyle bs;

            // Decide on the type of border to draw around image
            if (!this.Enabled)
                bs = IsPopup ? ButtonBorderStyle.Outset : ButtonBorderStyle.Solid;
            else if (m_mouseOver && m_mouseCapture)
                bs = ButtonBorderStyle.Inset;
            else if (IsPopup || m_mouseOver)
                bs = ButtonBorderStyle.Outset;
            else
                bs = ButtonBorderStyle.Solid;

            Color colorLeftTop;
            Color colorRightBottom;
            if (bs == ButtonBorderStyle.Solid)
            {
                colorLeftTop = this.BackColor;
                colorRightBottom = this.BackColor;
            }
            else if (bs == ButtonBorderStyle.Outset)
            {
                colorLeftTop = m_borderColor.IsEmpty ? this.BackColor : m_borderColor;
                colorRightBottom = this.BackColor;
            }
            else
            {
                colorLeftTop = this.BackColor;
                colorRightBottom = m_borderColor.IsEmpty ? this.BackColor : m_borderColor;
            }
            ControlPaint.DrawBorder(g, this.ClientRectangle,
                colorLeftTop, m_borderWidth, bs,
                colorLeftTop, m_borderWidth, bs,
                colorRightBottom, m_borderWidth, bs,
                colorRightBottom, m_borderWidth, bs);
        }

10. Example

Project: ceptr
Source File: InertButton.cs
View license
private void DrawBorder(Graphics g)
		{
			ButtonBorderStyle bs;

			// Decide on the type of border to draw around image
			if (!this.Enabled)
				bs = m_isPopup ? ButtonBorderStyle.Outset : ButtonBorderStyle.Solid;
			else if (m_mouseOver && m_mouseCapture)
				bs = ButtonBorderStyle.Inset;
			else if (m_isPopup || m_mouseOver)
				bs = ButtonBorderStyle.Outset;
			else
				bs = ButtonBorderStyle.Solid;

			Color colorLeftTop;
			Color colorRightBottom;
			if (bs == ButtonBorderStyle.Solid)
			{
				colorLeftTop = this.BackColor;
				colorRightBottom = this.BackColor;
			}
			else if (bs == ButtonBorderStyle.Outset)
			{
				colorLeftTop = m_borderColor.IsEmpty ? this.BackColor : m_borderColor;
				colorRightBottom = this.BackColor;
			}
			else
			{
				colorLeftTop = this.BackColor;
				colorRightBottom = m_borderColor.IsEmpty ? this.BackColor : m_borderColor;
			}
			ControlPaint.DrawBorder(g, this.ClientRectangle,
				colorLeftTop, m_borderWidth, bs,
				colorLeftTop, m_borderWidth, bs,
				colorRightBottom, m_borderWidth, bs,
				colorRightBottom, m_borderWidth, bs);
		}

11. Example

Project: BloomDesktop
Source File: SplashScreen.cs
View license
private void SplashScreen_Paint(object sender, PaintEventArgs e)
		{
			var borderWidth = 0;
			var color = Palette.BloomRed;
			ControlPaint.DrawBorder(e.Graphics, ClientRectangle, color,borderWidth, ButtonBorderStyle.Solid,
										color,borderWidth, ButtonBorderStyle.Solid,
										color,borderWidth, ButtonBorderStyle.Solid,
										color,borderWidth, ButtonBorderStyle.Solid);
		}

12. Example

Project: HOPE
Source File: InertButton.cs
View license
private void DrawBorder(Graphics g)
		{
			ButtonBorderStyle bs;

			// Decide on the type of border to draw around image
			if (!this.Enabled)
				bs = m_isPopup ? ButtonBorderStyle.Outset : ButtonBorderStyle.Solid;
			else if (m_mouseOver && m_mouseCapture)
				bs = ButtonBorderStyle.Inset;
			else if (m_isPopup || m_mouseOver)
				bs = ButtonBorderStyle.Outset;
			else
				bs = ButtonBorderStyle.Solid;

			Color colorLeftTop;
			Color colorRightBottom;
			if (bs == ButtonBorderStyle.Solid)
			{
				colorLeftTop = this.BackColor;
				colorRightBottom = this.BackColor;
			}
			else if (bs == ButtonBorderStyle.Outset)
			{
				colorLeftTop = m_borderColor.IsEmpty ? this.BackColor : m_borderColor;
				colorRightBottom = this.BackColor;
			}
			else
			{
				colorLeftTop = this.BackColor;
				colorRightBottom = m_borderColor.IsEmpty ? this.BackColor : m_borderColor;
			}
			ControlPaint.DrawBorder(g, this.ClientRectangle,
				colorLeftTop, m_borderWidth, bs,
				colorLeftTop, m_borderWidth, bs,
				colorRightBottom, m_borderWidth, bs,
				colorRightBottom, m_borderWidth, bs);
		}

13. Example

Project: SystemEx
Source File: EmulateExpInfoButton.cs
View license
private void EmulateExpInfoButton_Leave ( object sender, EventArgs e )
        {
            // Lost focus.
            // Correct way to erase a border?
            ControlPaint.DrawBorder ( 
                Graphics.FromHwnd ( this.label.Handle ),
                this.label.ClientRectangle,
                this.label.BackColor,
                ButtonBorderStyle.Solid
                );
        }

14. Example

Project: BitChatClient
Source File: CustomListView.cs
View license
protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            ControlPaint.DrawBorder(e.Graphics, ClientRectangle,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid);
        }

15. Example

Project: BitChatClient
Source File: CustomListViewItem.cs
View license
protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            ControlPaint.DrawBorder(e.Graphics, ClientRectangle,
                                         SeparatorColor, 0, ButtonBorderStyle.Solid,
                                         SeparatorColor, 0, ButtonBorderStyle.Solid,
                                         SeparatorColor, 0, ButtonBorderStyle.Solid,
                                         SeparatorColor, BORDER_SIZE, ButtonBorderStyle.Solid);
        }

16. Example

Project: BitChatClient
Source File: CustomPanel.cs
View license
protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            ControlPaint.DrawBorder(e.Graphics, ClientRectangle,
                                         BorderColor, 0, ButtonBorderStyle.Solid,
                                         BorderColor, 0, ButtonBorderStyle.Solid,
                                         BorderColorShadow, BORDER_SIZE * 2, ButtonBorderStyle.Solid,
                                         BorderColorShadow, BORDER_SIZE * 2, ButtonBorderStyle.Solid);

            ControlPaint.DrawBorder(e.Graphics, ClientRectangle,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid);
        }

17. Example

Project: BitChatClient
Source File: CustomListView.cs
View license
protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            ControlPaint.DrawBorder(e.Graphics, ClientRectangle,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid);
        }

18. Example

Project: BitChatClient
Source File: CustomListViewItem.cs
View license
protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            ControlPaint.DrawBorder(e.Graphics, ClientRectangle,
                                         SeparatorColor, 0, ButtonBorderStyle.Solid,
                                         SeparatorColor, 0, ButtonBorderStyle.Solid,
                                         SeparatorColor, 0, ButtonBorderStyle.Solid,
                                         SeparatorColor, BORDER_SIZE, ButtonBorderStyle.Solid);
        }

19. Example

Project: BitChatClient
Source File: CustomPanel.cs
View license
protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            ControlPaint.DrawBorder(e.Graphics, ClientRectangle,
                                         BorderColor, 0, ButtonBorderStyle.Solid,
                                         BorderColor, 0, ButtonBorderStyle.Solid,
                                         BorderColorShadow, BORDER_SIZE * 2, ButtonBorderStyle.Solid,
                                         BorderColorShadow, BORDER_SIZE * 2, ButtonBorderStyle.Solid);

            ControlPaint.DrawBorder(e.Graphics, ClientRectangle,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid,
                                         BorderColor, BORDER_SIZE, ButtonBorderStyle.Solid);
        }

20. Example

Project: UpDown-Meter
Source File: NetGraphForm.cs
View license
private void NetGraphForm_Paint(object sender, PaintEventArgs e) {
            // Force bottom and right to be drawn before top and left, causing the latter to overlap the former at the corners.
            ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle, Border3DStyle.RaisedInner, Border3DSide.Bottom | Border3DSide.Right);
            ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle, Border3DStyle.RaisedInner, Border3DSide.Top | Border3DSide.Left);

            // Draw toolbox edge.
            var toolboxEdge = toolbox.Bounds;
            toolboxEdge.Offset(-toolbox.Width, 0);
            ControlPaint.DrawBorder3D(e.Graphics, toolboxEdge, Border3DStyle.RaisedInner, Border3DSide.Right);

            // Draw status bar border.
            var statusBarBounds = statusBar.Bounds;
            statusBarBounds.Inflate(1, 1);
            ControlPaint.DrawBorder(e.Graphics, statusBarBounds, SystemColors.ButtonShadow, ButtonBorderStyle.Solid);
        }

21. Example

Project: xenadmin
Source File: FlickerFreePanel.cs
View license
protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (this.BorderStyle == BorderStyle.FixedSingle)
            {
                IntPtr hDC = Win32.GetWindowDC(this.Handle);
                Graphics g = Graphics.FromHdc(hDC);

                ControlPaint.DrawBorder(
                    g,
                    new Rectangle(0, 0, this.Width, this.Height),
                    _borderColor,
                    _borderWidth,
                    ButtonBorderStyle.Solid,
                    _borderColor,
                    _borderWidth,
                    ButtonBorderStyle.Solid,
                    _borderColor,
                    _borderWidth,
                    ButtonBorderStyle.Solid,
                    _borderColor,
                    _borderWidth,
                    ButtonBorderStyle.Solid);
                g.Dispose();
                Win32.ReleaseDC(Handle, hDC);
            }
        }

22. Example

Project: xenadmin
Source File: FlickerFreePanel.cs
View license
protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);

            if (this.BorderStyle == BorderStyle.FixedSingle)
            {
                IntPtr hDC = Win32.GetWindowDC(this.Handle);
                Graphics g = Graphics.FromHdc(hDC);

                ControlPaint.DrawBorder(
                    g,
                    new Rectangle(0, 0, this.Width, this.Height),
                    _borderColor,
                    _borderWidth,
                    ButtonBorderStyle.Solid,
                    _borderColor,
                    _borderWidth,
                    ButtonBorderStyle.Solid,
                    _borderColor,
                    _borderWidth,
                    ButtonBorderStyle.Solid,
                    _borderColor,
                    _borderWidth,
                    ButtonBorderStyle.Solid);
                g.Dispose();
                Win32.ReleaseDC(Handle, hDC);
            }
        }

23. Example

Project: NSMB-Editor
Source File: HexBox.cs
View license
protected override void OnPaintBackground(PaintEventArgs e)
		{
			switch(_borderStyle)
			{
				cas/n ..... /n //View Source file for more details /n }

24. Example

Project: NBTExplorer
Source File: HexBox.cs
View license
protected override void OnPaintBackground(PaintEventArgs e)
		{
			switch(_borderStyle)
			{
				cas/n ..... /n //View Source file for more details /n }

25. Example

Project: ME3Explorer
Source File: HexBox.cs
View license
protected override void OnPaintBackground(PaintEventArgs e)
        {
            switch (_borderSty/n ..... /n //View Source file for more details /n }

26. Example

Project: Be.HexEditor
Source File: HexBox.cs
View license
protected override void OnPaintBackground(PaintEventArgs e)
		{
			switch (_borderStyle)
			{
				ca/n ..... /n //View Source file for more details /n }

27. Example

Project: KUI
Source File: FlatWindow.cs
View license
protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.FillRectangle(Theme.ForeBrush, 1, 2, Width - 3, 30);
            e.Graphics.DrawString(Text, Theme.TitleFont, Theme.FontBrush, 4, 5);
            DrawShadow(e.Graphics);
            base.OnPaint(e);

            //Exit button
            if (_wnd_exitOver) e.Graphics.FillRectangle(Brushes.IndianRed, Width - 31, 2, 29, 29);
            e.Graphics.DrawLine(Theme.FontPen, Width - 31 + 9, 2 + 9, Width - 31 + 19, 2 + 19);
            e.Graphics.DrawLine(Theme.FontPen, Width - 31 + 19, 2 + 9, Width - 31 + 9, 2 + 19);

            //Maximize button
            if (_wnd_maximOver) e.Graphics.FillRectangle(Theme.BackBrush, Width - 60, 2, 29, 29);
            e.Graphics.DrawRectangle(Theme.FontPen, Width - 60 + 9, 2 + 9, 10, 10);

            //Minimize button
            if (_wnd_minimOver) e.Graphics.FillRectangle(Theme.BackBrush, Width - 89, 2, 29, 29);
            e.Graphics.DrawLine(Theme.FontPen, Width - 89 + 9, 2 + 19, Width - 89 + 19, 2 + 19);        

            if (WindowState != FormWindowState.Maximized)
                ControlPaint.DrawBorder(e.Graphics, ClientRectangle, Theme.AccentColor, ButtonBorderStyle.Solid);
        }

28. Example

Project: ATF
Source File: QuadPanelControl.cs
View license
protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

          /n ..... /n //View Source file for more details /n }