Posts Tagged ‘Panel’

How to set border color of a panel in c#

In c# for panel there no property to set border color directly.We can only set the border style using BorderStyle.

To set the border color of a panel,

Step 1 : Set BorderStyle property to None.

Step 2 : Draw a rectangle and set the pen color in paint event of the panel

private void panelpanelbordercolor1_Paint(object sender, PaintEventArgs e)
{
  e.Graphics.DrawRectangle(Pens.Red,
  e.ClipRectangle.Left,
  e.ClipRectangle.Top,
  e.ClipRectangle.Width - 1,
  e.ClipRectangle.Height -1);
  base.OnPaint(e);
}

Source Link

Popularity: 22% [?]

Designed by: Business Web Hosting | Thanks to Buy Icons, travel tips and Used Cars