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

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

            Invalidate(true);
        }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        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";
            }
        }
Exemplo n.º 6
0
 private void Form1_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     RectangleDoc.AddRectangle(e.Location, Color);
     Invalidate(true);
 }
Exemplo n.º 7
0
 public Form1()
 {
     InitializeComponent();
     this.DoubleBuffered = true;
     RectangleDoc        = new RectangleDoc();
 }
Exemplo n.º 8
0
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     rectangles = new RectangleDoc();
 }