T
Tony Johansson
Hi!
This example is from e-learning. It cause exception error at line 3 when
trying to change the DashStyle.
The exception is translated to english "ArgumentException was unhandled
It's not possible to make changes in the Pen because the priviligier are not
valid"
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = this.CreateGraphics();
Pen pen = SystemPens.ActiveBorder;
pen.DashStyle = DashStyle.Solid;
pen.Width = 2;
g.DrawLine(pen, 10, 10, 200, 10);
pen.Dispose();
}
So why is it not possible to change a pen object that has been returned from
a SystemPen ?
//Tony
This example is from e-learning. It cause exception error at line 3 when
trying to change the DashStyle.
The exception is translated to english "ArgumentException was unhandled
It's not possible to make changes in the Pen because the priviligier are not
valid"
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = this.CreateGraphics();
Pen pen = SystemPens.ActiveBorder;
pen.DashStyle = DashStyle.Solid;
pen.Width = 2;
g.DrawLine(pen, 10, 10, 200, 10);
pen.Dispose();
}
So why is it not possible to change a pen object that has been returned from
a SystemPen ?
//Tony