在函数DrawText()中生成的图形对象Graphics g要释放。
public void DrawText()
{
System.Drawing.Graphics g = this.CreateGraphics();
System.Drawing.Font f = CreateFont();
System.Drawing.SolidBrush b =new SolidBrush(this.m_FontColor);
g.DrawString("我是人",f,b,new Point(4,4));
g.Dispose();
}
要刷新图形,需要重画。在需要重画的地方调用DrawText()就可以啊。
public void DrawText()
{
System.Drawing.Graphics g = this.CreateGraphics();
System.Drawing.Font f = CreateFont();
System.Drawing.SolidBrush b =new SolidBrush(this.m_FontColor);
g.DrawString("我是人",f,b,new Point(4,4));
g.Dispose();
}
要刷新图形,需要重画。在需要重画的地方调用DrawText()就可以啊。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货