2 years ago
#69076

Calaf
Why is Paint event not rised with `FlatStyle.System`?
Why is the "Paint" event not raised by buttons that have the FlatStyle
property set to "System"? Using Flat
, Standard
and Popup
everything works fine. I searched for similar questions and read the official documentation, but I didn't find anything about this particular problem.
Here is a test code to check what I mean:
C# code
private void Form1_Load(object sender, EventArgs e)
{
button1.FlatStyle = FlatStyle.Standard;
button2.FlatStyle = FlatStyle.System;
button1.Paint += Button_Paint;
button2.Paint += Button_Paint;
}
private void Button_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(Pens.Black, 0, 0, 100, 50);
}
VB.NET code
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Button1.FlatStyle = FlatStyle.Standard
Button2.FlatStyle = FlatStyle.System
End Sub
Private Sub Button1_Paint(sender As Object, e As PaintEventArgs) Handles Button1.Paint, Button2.Paint
e.Graphics.DrawLine(Pens.Black, 0, 0, 100, 50)
End Sub
Output
c#
vb.net
paint
0 Answers
Your Answer