예제 #1
0
 private void PipButton_Click(object sender, EventArgs e)
 {
     try
     {
         tool = new PipTool((ActiveMdiChild as Canvas).Controls[0] as PictureBox);
         (ActiveMdiChild as Canvas).tool = tool;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }
예제 #2
0
 private void StarButton_Click(object sender, EventArgs e)
 {
     try
     {
         tool = new StarTool(Int32.Parse(VertexNumber.Text), (ActiveMdiChild as Canvas).Controls[0] as PictureBox);
         (ActiveMdiChild as Canvas).tool = tool;
     }
     catch (Exception)
     {
         MessageBox.Show("Количество вершин звезды должно быть" +
                         " в пределах от 3 до 1000", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }
예제 #3
0
        private void Paint_Load(object sender, EventArgs e)
        {
            filenames  = new StringDictionary();
            arraylines = new object[] { 0, 1, 2, 3, 4 };

            VertexNumber.Text = "5";

            lineStylesComboBox.Size                  = new System.Drawing.Size(55, 30);
            lineStylesComboBox.Margin                = new System.Windows.Forms.Padding(0, 2, 5, 4);
            lineStylesComboBox.DrawMode              = DrawMode.OwnerDrawFixed;
            lineStylesComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            lineStylesComboBox.FormattingEnabled     = true;
            lineStylesComboBox.DrawItem             += OnDrawItem;
            lineStylesComboBox.SelectedIndexChanged += OnSelectChange;
            lineStylesComboBox.Items.AddRange(arraylines);
            lineStylesComboBox.SelectedIndex = 0;

            ToolStripControlHost combo = new ToolStripControlHost(lineStylesComboBox);

            toolStrip.Items.Add(combo);
            toolStrip.Items.Add(new ToolStripSeparator());

            Label l = new Label();

            l.Text      = "Размер кисти: ";
            l.TextAlign = ContentAlignment.MiddleCenter;
            ToolStripControlHost t = new ToolStripControlHost(l);

            toolStrip.Items.Add(t);

            NumericUpDown penSize = new NumericUpDown();

            penSize.Size          = new System.Drawing.Size(55, 35);
            penSize.Padding       = new System.Windows.Forms.Padding(0, 2, 6, 4);
            penSize.ValueChanged += OnValueChanged;
            penSize.Minimum       = 1;
            ToolStripControlHost m_toolhost = new ToolStripControlHost(penSize);

            toolStrip.Items.Add(m_toolhost);

            curCanva           = new Canvas();
            curCanva.MdiParent = this;
            curCanva.Show();
            curCanva.Name     = "1New";
            curCanva.Location = new Point(0, 0);
            WindowsButton.DropDownItems[0].Text = "1 Новый";
            WindowsButton.DropDownItems[0].Name = "1New";
            (WindowsButton.DropDownItems[0] as ToolStripMenuItem).Checked = true;
            filenames.Add(curCanva.Name, "New");
            WindowsButton.DropDownItemClicked += WinDropDownItemClick;

            AllTools.MainPict = Color.Black;

            tool           = new PencilTool(curCanva.Controls[0] as PictureBox);
            curCanva.tool  = tool;
            timer          = new Timer();
            timer.Interval = 1000;
            timer.Tick    += OnTimer;

            this.LayoutMdi(MdiLayout.TileHorizontal);

            FindPlugins();
            CreatePluginsMenu();
        }