using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; public class Form1 : System.Windows.Forms.Form { [STAThread] static void Main() { Application.Run(new Form1()); } protected override void OnPaint(PaintEventArgs e) { Graphics g; g = Graphics.FromHwnd(this.Handle); g.FillRectangle(new SolidBrush(Color.Red), 10, 10, 210, 50); // Rectangle r = new Rectangle(40, 20, 30, 30); Color c = Color.FromArgb(255, 255, 255, 0); g.FillRectangle(new SolidBrush(c), r); r.Offset(30, 0); c = Color.FromArgb(200, 255, 255, 0); g.FillRectangle(new SolidBrush(c), r); r.Offset(30, 0); c = Color.FromArgb(150, 255, 255, 0); g.FillRectangle(new SolidBrush(c), r); r.Offset(30, 0); c = Color.FromArgb(100, 255, 255, 0); g.FillRectangle(new SolidBrush(c), r); r.Offset(30, 0); c = Color.FromArgb(50, 255, 255, 0); g.FillRectangle(new SolidBrush(c), r); g.Dispose(); } }