示例#1
0
        private void rct_MouseMove(object sender, MouseEventArgs e)
        {
            Shape  s = null;
            int    norm = (int)sets[PREF_POINT]; int change = 10;
            SHAPES shape = (SHAPES)sets[PREF_SHAPE];

            switch (shape)
            {
            case SHAPES.CIRCLE: s = new Ellipse {
                    Width = norm, Height = norm
            }; break;

            case SHAPES.OVAL_H: s = new Ellipse {
                    Width = norm - change, Height = norm
            }; break;

            case SHAPES.OVAL_W: s = new Ellipse {
                    Width = norm, Height = norm - change
            }; break;

            case SHAPES.RECTANGLE_H: s = new Rectangle {
                    Width = norm - change, Height = norm
            }; break;

            case SHAPES.RECTANGLE_W: s = new Rectangle {
                    Width = norm, Height = norm - change
            }; break;

            case SHAPES.SQUARE: s = new Rectangle {
                    Width = norm, Height = norm
            }; break;

            default: break;
            }
            SolidColorBrush scb = new SolidColorBrush(new Color());

            foreach (StylusPoint p in e.StylusDevice.GetStylusPoints(canvas))
            {
                paintShape(scb, p, s);
            }
        }
示例#2
0
 private void ShapeItemClick(object sender, EventArgs e)
 {
     Shape = (SHAPES)Activator.CreateInstance((Type)((Control)sender).Tag);
     list.Add(Shape);
 }
示例#3
0
 private void ShapeItemClick(object sender, EventArgs e)
 {
     Shape = (SHAPES)Activator.CreateInstance((Type)((Control)sender).Tag);
     list.Add(Shape);
 }
示例#4
0
文件: MainForm.cs 项目: Dr1N/PaintNET
        private void ToolButton_Click(object sender, EventArgs e)
        {
            //Режим редактирования фигуры - не позволяет переключаться

            if (this.isEdit) { return; }

            //Снять нажатие

            foreach (var item in this.toolStrip1.Items)
            {
                ToolStripButton button = item as ToolStripButton;
                if (button != null)
                {
                    button.CheckState = CheckState.Unchecked;
                }
            }

            //Установить нажатие

            ((ToolStripButton)sender).CheckState = CheckState.Checked;

            //Установить тип фигуры

            switch (((ToolStripButton)sender).Name)
            {
                case "tsb_pen":
                    this.typeTool = SHAPES.PEN;
                    this.tssl_tool.Text = "Tool: Карандаш";
                    break;
                case "tsb_line":
                    this.typeTool = SHAPES.LINE;
                    this.tssl_tool.Text = "Tool: Линия";
                    break;
                case "tsb_rect":
                    this.typeTool = SHAPES.RECTANGLE;
                    this.tssl_tool.Text = "Tool: Прямоугольник";
                    break;
                case "tlb_fillrect":
                    this.typeTool = SHAPES.FILLRECTANGLE;
                    this.tssl_tool.Text = "Tool: Залитый прямоугольник";
                    break;
                case "tlb_elips":
                    this.typeTool = SHAPES.ELLIPS;
                    this.tssl_tool.Text = "Tool: Эллипс";
                    break;
                case "tlb_fillelips":
                    this.typeTool = SHAPES.FILLELLIPS;
                    this.tssl_tool.Text = "Tool: Залитый эллипс";
                    break;
                case "tlb_fill":
                    this.typeTool = SHAPES.FILLTOOL;
                    this.tssl_tool.Text = "Tool: Заливка";
                    break;
                case "tlb_colorChoicer":
                    typeTool = SHAPES.COLORCHOICE;
                    this.tssl_tool.Text = "Tool: Выбор цвета";
                    break;
                default:
                    break;
            }
        }