示例#1
0
 public Painter()
 {
     InitializeComponent();
     bitmap            = StaticBitmap.GetInstance();
     _currentColor     = Color.Black;
     _currentThickness = 1;
     _fillColor        = Color.Transparent;
     bitmap.Bitmap     = new Bitmap(pictureBox.Width, pictureBox.Height);
     bitmap.tmpBitmap  = new Bitmap(pictureBox.Width, pictureBox.Height);
     Change_location.Hide();
     DeleteFigure.Hide();
     Reversal.Hide();
     textBox1.Hide();
     mode = "Рисуем";
     //saveFile.Click += saveFile_Click;
     //openFile.Click += openFile_Click;
     openFileDialog1.Filter = "Winx files(*.winx)|*.winx|All files(*.*)|*.*";
     saveFileDialog1.Filter = "Winx files(*.winx)|*.winx|All files(*.*)|*.*";
     //ActiveFigure = null;
 }
示例#2
0
        private void toolBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            Change_location.Hide();
            DeleteFigure.Hide();
            Reversal.Hide();

            switch (toolBox.SelectedIndex)
            {
            case 1:
                textBox1.Hide();
                factoryFigure = new LineFactory();
                break;

            case 2:
                textBox1.Hide();
                factoryFigure = new RectangleFactory();
                break;

            case 3:
                textBox1.Hide();
                factoryFigure = new SquareFactory();
                break;

            case 4:
                textBox1.Show();
                if (textBox1.Text == "Количество граней")
                {
                    MessageBox.Show("Введите количество граней 3 или больше.");
                }
                textBox1.Text = "";
                factoryFigure = new NSidedPolygonFactory();
                break;

            case 5:
                textBox1.Hide();
                factoryFigure = new TrapezoidFactory();
                break;

            case 6:
                textBox1.Hide();
                factoryFigure = null;
                break;

            case 7:
                textBox1.Hide();
                factoryFigure = new RightTriangleFactory();
                break;

            case 8:
                textBox1.Hide();
                factoryFigure = new IsoscelesTriangleFactory();
                break;

            case 10:
                textBox1.Hide();
                factoryFigure = new CircleFactory();
                break;

            case 11:
                textBox1.Hide();
                factoryFigure = new EllipseFactory();
                break;
            }
        }