标签:style blog http color ar for 2014 div sp
public class WindowOne:Form { public WindowOne() { InitializeCompnent(); } public void InitializeCompnent() { this.Width = 200; this.Height = 200; } //冲毁window 方法 private void ReDraw(Graphics g) { Random ran = new Random(); //Color ranColor = Color.FromArgb(ran.Next(256), ran.Next(256) // , ran.Next(256), ran.Next(256)); Color ranColor = Color.FromArgb(100, ran.Next(256) , ran.Next(256), ran.Next(256)); g.Clear(ranColor); } /// <summary> /// 窗体绘制 事件 /// </summary> /// <param name="e"></param> protected override void OnPaint(PaintEventArgs e) { //base.OnPaint(e); ReDraw(e.Graphics); } /// <summary> /// 窗体大小 重置 /// </summary> /// <param name="e"></param> protected override void OnResize(EventArgs e) { //强制重新绘制 this.Invalidate(); } }
显示结果:
标签:style blog http color ar for 2014 div sp
原文地址:http://www.cnblogs.com/tianmahygj/p/3960582.html