Exemplo n.º 1
0
 public Line(StyleLine style, int en1, int id)
 {
     Entity_1   = en1;
     Id         = id;
     Select     = false;
     this.style = style;
 }
Exemplo n.º 2
0
 public Line(StyleLine style, string value, int en1, int en2, int id)
 {
     this.style = style;
     Value      = value;
     Entity_1   = en1;
     Entity_2   = en2;
     Id         = id;
     Select     = false;
 }
Exemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();
            bmp = new Drawing(BasicPictureBox.Width, BasicPictureBox.Height);
            Font  font  = new Font(FontFamily.GenericSansSerif, 14f, FontStyle.Regular);
            Color color = Color.Black;

            object[] hatchStyle = Enum.GetValues(typeof(HatchStyle)).Cast <object>().ToArray();
            comboBoxHatchStyle.Items.AddRange(hatchStyle);
            object[] gradMode = Enum.GetValues(typeof(LinearGradientMode)).Cast <object>().ToArray();
            comboBoxGradMode.Items.AddRange(gradMode);
            object[] lineCapStyle = Enum.GetValues(typeof(LineCap)).Cast <object>().ToArray();
            comboBoxEndCap.Items.AddRange(lineCapStyle);
            style_o = new StyleObject(color, font, new SolidBrush(SetColorBrush.BackColor), new Pen(SetColorPen.BackColor, (float)WidthUpDown.Value), 0, false, Figure.Rectangle);
            style_o.myBrushTexture = new TextureBrush(new Bitmap("C:\\Users\\Valentin\\source\\repos\\Computer_Graphics\\Cg_SixthProject\\Cg_SixthProject\\bin\\Debug\\texture.bmp"));
            style_l = new StyleLine(color, font, new Pen(SetColorPen.BackColor, (float)WidthUpDown.Value));
        }
Exemplo n.º 4
0
        public void Draw(byte fl_tools, ref MouseEventArgs e0, MouseEventArgs e, StyleLine style = null, StyleObject style2 = null)
        {
            _current_bitmap = (Bitmap)bitmap.Clone();
            g = Graphics.FromImage(_current_bitmap);
            switch (fl_tools)
            {
            case 3:
                g.DrawLine(style.Pen, P(e0), P(e));
                break;

            case 0:
                if (style2.Figure == Figure.Rectangle)
                {
                    if (!style2.Fill)
                    {
                        g.DrawRectangle(style2.Pen, e0.X, e0.Y, e.X - e0.X, e.Y - e0.Y);
                    }
                    else
                    {
                        SetBrush(style2);
                        g.DrawRectangle(style2.Pen, e0.X, e0.Y, e.X - e0.X, e.Y - e0.Y);
                        g.FillRectangle(style2.myBrush, e0.X, e0.Y, e.X - e0.X, e.Y - e0.Y);
                    }
                }
                else if (style2.Figure == Figure.Ellipse)
                {
                    if (!style2.Fill)
                    {
                        g.DrawEllipse(style2.Pen, e0.X, e0.Y, e.X - e0.X, e.Y - e0.Y);
                    }
                    else
                    {
                        SetBrush(style2);
                        g.DrawEllipse(style2.Pen, e0.X, e0.Y, e.X - e0.X, e.Y - e0.Y);
                        g.FillEllipse(style2.myBrush, e0.X, e0.Y, e.X - e0.X, e.Y - e0.Y);
                    }
                }
                Width_Node  = e.X - e0.X;
                Height_Node = e.Y - e0.Y;
                break;
            }
        }
Exemplo n.º 5
0
        private void BasicPictureBox_MouseUp(object sender, MouseEventArgs e)
        {
            e1 = e;
            if (network.e1 == null && fl_tools == 3)
            {
                network.DrawFigure();
            }
            if (e.Button == MouseButtons.Right && network.SeacrhNode(e.X, e.Y) != null)
            {
                contextMenuStrip1.Show(MousePosition, ToolStripDropDownDirection.Right);
                return;
            }
            drawing      = false;
            bmp.GetImage = Drawing.Answer;
            StyleObject _clone_style_o   = (StyleObject)style_o.Clone();
            StyleLine   _clone_styleLine = (StyleLine)style_l.Clone();

            switch (fl_tools)
            {
            case 0:
                network.AddNode(_clone_style_o, null, network.entities.Count, e0.X, e0.Y, Drawing.Width_Node, Drawing.Height_Node);
                break;

            case 1:
                network.DeleteNode(e.X, e.Y);
                network.DrawFigure();
                break;

            case 2:
                network.NewXY(e0.X, e0.Y, e.X, e.Y);
                network.DrawFigure();
                break;

            case 3:
                if (network.SeacrhNode(e.X, e.Y) != null)
                {
                    network.SelectNode(e.X, e.Y);
                    network.AddLine(_clone_styleLine);
                    network.DrawFigure();
                }
                break;

            case 4:

                break;

            case 6:
                network.SelectNode(e.X, e.Y);
                entity = network.SeacrhNode(e.X, e.Y);
                if (entity != null && entity.Select)
                {
                    ShowIntruments();
                }
                else
                {
                    entity = null;
                }
                network.DrawFigure();
                break;
            }
            Draw();
            network.e1 = null;
            network.e2 = null;
        }