日期:2014-05-17 浏览次数:20883 次
private void Form1_Load(object sender, EventArgs e)//这里写这些 对不对呀?肿么感觉效果不明显啊
{
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
}
protected override void OnPaint(PaintEventArgs e)
{
Rectangle rect = e.ClipRectangle;
Bitmap bufferimage = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(bufferimage);
//这中间是不是少了什么东西?那个显示在显示器上的怎么让它先绘制到bufferimage里面啊?
this.CreateGraphics().DrawImage(bufferimage, 0, 0);
}
Bitmap bmp = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(bmp);
g.DrawString("sssss", this.Font, Brushes.Red,10,10);
this.BackgroundImage = bmp;