Beispiel #1
0
 public Form1()
 {
     InitializeComponent();
     rectangles     = new RectangleDoc();
     currentColor   = Color.Red;
     DoubleBuffered = true;
 }
        private void timer_Tick(object sender, EventArgs e)
        {
            int height = this.Height - statusStrip1.Height;

            RectangleDoc.MoveRectangles(height);
            RectangleDoc.RotateRectangles(this.Width);

            Invalidate(true);
        }
 private void Form1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         RectangleDoc.LeftButtonClick(e.Location);
     }
     else if (e.Button == MouseButtons.Right)
     {
         RectangleDoc.RightButtonClick(e.Location);
     }
 }
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            timer.Stop();

            if (MessageBox.Show("Are you sure you want to start a new game?", "Start a new game",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                RectangleDoc = new RectangleDoc();
                Filename     = string.Empty;
                Color        = Color.Green;
                Invalidate(true);
            }

            timer.Start();
        }
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.Clear(Color.White);

            RectangleDoc.DrawRectangles(e.Graphics);

            if (Filename != string.Empty)
            {
                this.Text = $"Moving Rectangles | {Filename.Substring(Filename.LastIndexOf(@"\") + 1)}";
            }
            else
            {
                this.Text = "Moving Rectangles";
            }
        }
 private void Form1_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     RectangleDoc.AddRectangle(e.Location, Color);
     Invalidate(true);
 }
 public Form1()
 {
     InitializeComponent();
     this.DoubleBuffered = true;
     RectangleDoc        = new RectangleDoc();
 }
Beispiel #8
0
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     rectangles = new RectangleDoc();
 }