// hook into control paint events change their appearance
// standard Button control does not have properties to control the
// border size or color. In this code , you hook into the button’s Paint event and
// modify its appearance.
private void ChangeButtonBorder(object sender, System.Windows.Forms.PaintEventArgs e)
{
// Hook into the paint event for myButton. Create a new graphics object
// and paint a custom border around the button.
System.Drawing.Graphics g = e.Graphics;
int BorderWidth = 3;
System.Drawing.Color BorderColor = System.Drawing.Color.Blue;
System.Windows.Forms.ControlPaint.DrawBorder(
g, e.ClipRectangle, BorderColor, BorderWidth,
System.Windows.Forms.ButtonBorderStyle.Solid, BorderColor, BorderWidth,
System.Windows.Forms.ButtonBorderStyle.Solid, BorderColor, BorderWidth,
System.Windows.Forms.ButtonBorderStyle.Solid, BorderColor, BorderWidth,
System.Windows.Forms.ButtonBorderStyle.Solid);
}
|