关于GDI+ 的问题
为什么我运行的下面的代码,运行之后,却没有任何反应呢
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen pn = new Pen(Color.Blue, 100);
Rectangle rect = new Rectangle(50, 50, 200, 200);
g.DrawEllipse(pn, rect);
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
Graphics g = this.CreateGraphics();
Pen pen = new Pen(Color.Red );
Rectangle rect = new Rectangle(50, 50, 200, 100);
g.DrawArc(pen, rect, 12, 84);
------解决方案--------------------你的代码没有问题哈...可以运行..你看...
你同时运行才行...貌似你的 Panel要借助Form,如果你单单运行Panel的 Paint..貌似不行...
------解决方案--------------------上面貌似说错了...你要注意你是在 Panel上画的圆弧,你的坐标要在 Panel范围.
应该这样才行..
private void panel1_Paint(object sender, PaintEventArgs e) {
Graphics g = e.Graphics;
Pen pen = new Pen(Color.Red);
Rectangle rect = new Rectangle(50, 50, 200, 100);
g.DrawArc(pen, rect, 12, 84);