Hello Everybody,
I would like to change windows default minimize style for my C# project and add another style. Is it possible to change minimize style?
If is it possible please help me.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaganathan BantheswaranPosted Dec 14, 2013, 12:54 AM
You can change using VisualStyleRenderer. But you have to create your own graphics image.
Paste the below code into your Windows Form. Handle the form's Paint event and call the ChangeMinimizeButtonStyle method from the Paint event-handling method, passing e as PaintEventArgs.
public void ChangeMinimizeButtonStyle (PaintEventArgs e)
{
if (VisualStyleRenderer.IsElementDefined(
VisualStyleElement.Window.MinButton.Normal))
{
VisualStyleRenderer renderer =
new VisualStyleRenderer(VisualStyleElement.Window.MinButton.Normal);
Rectangle rectangle1 = new Rectangle(10, 50, 50, 50);
renderer.DrawBackground(e.Graphics, rectangle1);
e.Graphics.DrawString("VisualStyleElement.Window.MinButton.Normal",
this.Font, Brushes.Black, new Point(10, 10));
}
else
e.Graphics.DrawString("This element is not defined in the current visual style.",
this.Font, Brushes.Black, new Point(10, 10));
}
Jaganathan BantheswaranPosted Dec 14, 2013, 12:54 AM
You can change using VisualStyleRenderer. But you have to create your own graphics image.
Paste the below code into your Windows Form. Handle the form's Paint event and call the ChangeMinimizeButtonStyle method from the Paint event-handling method, passing e as PaintEventArgs.
public void DrawVisualStyleElementWindowCloseButton2(PaintEventArgs e)
{
if (VisualStyleRenderer.IsElementDefined(
VisualStyleElement.Window.MinButton.Normal))
{
VisualStyleRenderer renderer =
new VisualStyleRenderer(VisualStyleElement.Window.MinButton.Normal);
Rectangle rectangle1 = new Rectangle(10, 50, 50, 50);
renderer.DrawBackground(e.Graphics, rectangle1);
e.Graphics.DrawString("VisualStyleElement.Window.MinButton.Normal",
this.Font, Brushes.Black, new Point(10, 10));
}
else
e.Graphics.DrawString("This element is not defined in the current visual style.",
this.Font, Brushes.Black, new Point(10, 10));
}