C
Christopher Ireland
Hello!
The following simple code can be used to see the behaviour which I would
like to understand a little further:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
int start = 0, sweep = 135;
Rectangle rect = e.ClipRectangle;
rect.Inflate(-50, -50);
if(rect.Height > 0 && rect.Width > 0)
e.Graphics.DrawArc(Pens.Red, rect, start, sweep);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
Invalidate();
}
}
If you now resize the form you will see how the end point of the arc seems
to change position; resizing horizontally will give you an arc which appears
to trace nearly 180º. Changing the value "sweep" to 90º does not produce the
same effect, however.
Can anybody please help me by shedding a little light on this behaviour?
The following simple code can be used to see the behaviour which I would
like to understand a little further:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
int start = 0, sweep = 135;
Rectangle rect = e.ClipRectangle;
rect.Inflate(-50, -50);
if(rect.Height > 0 && rect.Width > 0)
e.Graphics.DrawArc(Pens.Red, rect, start, sweep);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
Invalidate();
}
}
If you now resize the form you will see how the end point of the arc seems
to change position; resizing horizontally will give you an arc which appears
to trace nearly 180º. Changing the value "sweep" to 90º does not produce the
same effect, however.
Can anybody please help me by shedding a little light on this behaviour?