C#中用graphics画图怎么不显示啊!急!!!!!!
SolidBrushm=newSolidBrush(Color.Red);Graphicsg=this.CreateGraphics();g.FillEllipse(m,...
SolidBrush m = new SolidBrush(Color.Red);
Graphics g = this.CreateGraphics();
g.FillEllipse(m, new Rectangle(0, 0, 100, 100)); 展开
Graphics g = this.CreateGraphics();
g.FillEllipse(m, new Rectangle(0, 0, 100, 100)); 展开
展开全部
你是用窗体的load事件画图吧?试试下面的代码:
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
SolidBrush m = new SolidBrush(Color.Red);
g.FillEllipse(m, new Rectangle(0, 0, 100, 100));
}
窗体重绘时,引发Paint事件,应该在Paint事件中画图,窗体改动和重启仍然有图形。如果放在Load事件中,绘图后随着窗体启动消失了。
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
SolidBrush m = new SolidBrush(Color.Red);
g.FillEllipse(m, new Rectangle(0, 0, 100, 100));
}
窗体重绘时,引发Paint事件,应该在Paint事件中画图,窗体改动和重启仍然有图形。如果放在Load事件中,绘图后随着窗体启动消失了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询