Esempio n. 1
0
 private void ClearButton_Click(object sender, EventArgs e)
 {
     //clear paint
     FigureslistBox.Items.Clear();
     drawList.Clear();
     Paint_Panel.Invalidate();
 }
Esempio n. 2
0
 private void changePanelColorToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (ContourcolorDialog.ShowDialog() == DialogResult.OK)
     {
         Paint_Panel.BackColor = ContourcolorDialog.Color;
         Paint_Panel.Invalidate();
     }
 }
Esempio n. 3
0
 private void ThiknesscomboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (FigureslistBox.SelectedIndex != -1)
     {
         drawList[FigureslistBox.SelectedIndex].Thikness = ThiknessList[ThiknesscomboBox.SelectedIndex];
         Paint_Panel.Invalidate();
     }
 }
Esempio n. 4
0
 private void BrushColorButton_Click(object sender, EventArgs e)
 {
     if (BrushColorDialog.ShowDialog() == DialogResult.OK)
     {
         BrushColorButton.BackColor = BrushColorDialog.Color;
         if (FigureslistBox.SelectedIndex != -1)
         {
             drawList[FigureslistBox.SelectedIndex].BrushColor = BrushColorDialog.Color;
             Paint_Panel.Invalidate();
         }
     }
 }
Esempio n. 5
0
 private void FigureslistBox_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (FigureslistBox.SelectedIndex != -1)
     {
         if (e.KeyChar == (Char)Keys.Back)
         {
             // drawList[FigureslistBox.SelectedIndex].
             drawList.RemoveAt(FigureslistBox.SelectedIndex);
             FigureslistBox.Items.Remove(FigureslistBox.SelectedItem);
             Paint_Panel.Invalidate();
         }
     }
 }
Esempio n. 6
0
        private void saveYourOwnFigureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UserFigureForm frm = new UserFigureForm(drawList);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (drawList.Count >= 2)
                {
                    FigureList.figures.Add(frm.uf);
                    Figure_comboBox.Items.Add(frm.uf.GetName());
                    FigureslistBox.Items.Clear();
                    drawList.Clear();
                    Paint_Panel.Invalidate();
                }
            }
        }
Esempio n. 7
0
        private void OpenMenuItem_Click(object sender, EventArgs e)
        {
            FigureslistBox.Items.Clear();
            string tmp = null;

            openFileDialog.Filter = "All files(*.*) | *.dat";
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                drawList = Picture.Deserialize(openFileDialog.FileName);
                if (drawList == null)
                {
                    drawList = new List <Figure>();
                }
                for (var i = 0; i < drawList.Count; i++)
                {
                    tmp = drawList[i].GetName();
                    FigureslistBox.Items.Add(tmp);
                }
                Paint_Panel.Invalidate();
            }
        }
Esempio n. 8
0
        private void Draw_button_Click(object sender, EventArgs e)
        {
            string tmp = null;

            //dynamically create a copy of the figure, add it to the list, then draw
            drawList.Add(FigureList.figures[Figure_comboBox.SelectedIndex].CreateCopy(points, ContourcolorDialog.Color, ThiknessList[ThiknesscomboBox.SelectedIndex], BrushColorDialog.Color));
            if (points.Count != drawList[drawList.Count - 1].pointCount)
            {
                drawList.Remove(drawList[drawList.Count - 1]);
            }
            else
            {
                tmp = drawList[drawList.Count - 1].GetName();
                FigureslistBox.Items.Add(tmp);
            }

            points.Clear();
            foreach (var tb in tbList)
            {
                tb.Clear();
            }
            Paint_Panel.Invalidate();
        }