Introduction to OOP | Chapter 9: A Solitare Game: | next | previous | audio | real | text |
public class Solitaire : System.WinForms.Form { // start of automatically generated code private System.ComponentModel.Container components; public Solitaire() { InitializeComponent(); } public override void Dispose() { base.Dispose(); components.Dispose(); } private void InitializeComponent() { this.components = new System.ComponentModel.Container (); this.Text = "Solitaire"; this.AutoScaleBaseSize = new System.Drawing.Size (5, 13); this.ClientSize = new System.Drawing.Size (392, 373); } // end of automatically generated code protected override void OnMouseDown (MouseEventArgs e ) { Game.mouseDown(e.X, e.Y); this.Invalidate(); // force screen redraw } protected override void OnPaint (PaintEventArgs pe ) { Graphics g = pe.Graphics; CardView cv = new WinFormsCardView(g); Game.paint(cv); } public static void Main(string[] args) { Application.Run(new Solitaire()); } }