コード例 #1
0
        private void LampsCanvas_Click(object sender, EventArgs e)
        {
            // The mouse has been clicked on the lamps canvas
            MouseButtonDown = true;

            if (LampsHolder == null)
            {
                //CreateNewLamps();
            }

            LampsCanvas.Invalidate();
        }
コード例 #2
0
        private void DeselectAllLamps_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < LampsCounter; i++)
            {
                LampsHit[i] = false;
            }

            // The mouse has been clicked on the lamps canvas
            MouseButtonDown = true;

            // Invalidate the canvas to be able to draw
            LampsCanvas.Invalidate();
        }
コード例 #3
0
        private void AddLamps_Click(object sender, EventArgs e)
        {
            // Get the number of lamps to be created
            LampsCounter = int.Parse(ChooseLamps.Items[ChooseLamps.SelectedIndex].ToString());
            PaintLamps   = true;

            // Enable the selection buttons
            MarkAllLamps.Enabled     = true;
            DeselectAllLamps.Enabled = true;
            MarkAllLamps.Visible     = true;
            DeselectAllLamps.Visible = true;

            // Update the lamps
            DrawFunction.CreateLamps();

            // Invalidate the canvas to be able to draw
            LampsCanvas.Invalidate();
        }
コード例 #4
0
        private void RemoveLamps_Click(object sender, EventArgs e)
        {
            // Remove all lamps from the canvas
            foreach (Control lamp in LampsCanvas.Controls)
            {
                LampsCanvas.Controls.Remove(lamp);
            }

            PaintLamps = false;

            // Disable the selection buttons
            MarkAllLamps.Enabled     = false;
            DeselectAllLamps.Enabled = false;
            MarkAllLamps.Visible     = false;
            DeselectAllLamps.Visible = false;

            // Invalidate the canvas to be able to draw
            LampsCanvas.Invalidate();
        }