Пример #1
0
        public override void Draw(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            Graphics dc = e.Graphics;
            Brush    brush;
            Pen      pen = new Pen(Color.Black);

            pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
            if (selected == false)
            {
                brush = new SolidBrush(Color);
            }
            else
            {
                brush = new SolidBrush(SelectedColor);
            }

            dc.FillEllipse(brush, rect);
            dc.DrawEllipse(pen, rect);
            dc.DrawLine(pen, this.center_point, label_name.CenterPoint);
            label_name.draw(sender, e);
        }
Пример #2
0
        private bool creation_flag;   //используется при создании

        public new void Draw(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            Graphics dc = e.Graphics;
            Brush    brush;
            Pen      pen = new Pen(Color.Black);

            pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
            if (selected == false)
            {
                brush = new SolidBrush(color);
            }
            else
            {
                brush = new SolidBrush(SelectedColor);
            }

            dc.FillEllipse(brush, rect);
            dc.DrawEllipse(new Pen(Color.Black), rect);
            dc.DrawLine(pen, this.CenterPoint, label_name.CenterPoint);
            label_name.draw(sender, e);
            if (selected == true)
            {
                brush = new SolidBrush(Color.Black);
                dc.FillRectangle(brush, rect.Left, rect.Top, 5, 5);
                dc.FillRectangle(brush, (rect.Left + (rect.Right - rect.Left) / 2), rect.Top, 5, 5);
                dc.FillRectangle(brush, rect.Right - 5, rect.Top, 5, 5);

                dc.FillRectangle(brush, rect.Left, rect.Bottom - 5, 5, 5);
                dc.FillRectangle(brush, (rect.Left + (rect.Right - rect.Left) / 2), rect.Bottom - 5, 5, 5);
                dc.FillRectangle(brush, rect.Right - 5, rect.Bottom - 5, 5, 5);

                dc.FillRectangle(brush, rect.Left, (rect.Top + (rect.Bottom - rect.Top) / 2), 5, 5);
                dc.FillRectangle(brush, rect.Right - 5, (rect.Top + (rect.Bottom - rect.Top) / 2), 5, 5);
            }
        }
Пример #3
0
        public override void Draw(object sender, PaintEventArgs e)
        {
            Point start_point;
            Point end_point;
            Point priority_point;

            start_point = core.Bitmap.GetCommonPoint(state_begin, this, true);
            end_point   = core.Bitmap.GetCommonPoint(state_end, this, false);

            #region getting_priority_point
            priority_point = start_point;
            #endregion

            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            Graphics dc = e.Graphics;
            Pen      pen;
            if (selected == false)
            {
                pen = new Pen(color, 1);
            }
            else
            {
                pen = new Pen(SelectedColor, 1);
            }

            AdjustableArrowCap My_Cap = new AdjustableArrowCap(5, 10);
            My_Cap.BaseCap   = LineCap.Triangle;
            pen.CustomEndCap = My_Cap;

            if (DrawStyle == DrawningStyle.DrawningBezier)
            {
                dc.DrawBezier(pen, start_point, Angle1, Angle2, end_point);
            }
            else
            {
                Point[] points = { start_point, Angle1, Angle2, end_point };
                dc.DrawCurve(pen, points);
            }

            #region draw_priority_point
            if (core.Paper.ShowLinePriority == true)
            {
                Rectangle rt    = new Rectangle(priority_point.X - 10, priority_point.Y - 10, 20, 20);
                Brush     brush = new SolidBrush(Color.DarkOrange);
                dc.FillEllipse(brush, rt);
                dc.DrawEllipse(pen, rt);
                System.Drawing.StringFormat format = new StringFormat();
                format.Alignment     = StringAlignment.Center;
                format.LineAlignment = StringAlignment.Center;
                dc.DrawString(priority.ToString(), new Font("Times New Roman", 10, FontStyle.Bold), new SolidBrush(Color.Black), rt, format);
            }
            #endregion
            if (string.IsNullOrEmpty(label_condition.Text) == false)
            {
                label_condition.draw(sender, e);
            }

            if (selected == true)
            {
                Pen pen2 = new Pen(color);
                pen2.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                if (string.IsNullOrEmpty(label_condition.Text) == false)
                {
                    dc.DrawLine(pen2, label_condition.CenterPoint, state_begin.CenterPoint);
                    dc.DrawLine(pen2, label_condition.CenterPoint, state_end.CenterPoint);
                }
                dc.FillRectangle(new SolidBrush(Color.Black), Angle1.X - 2, Angle1.Y - 2, 4, 4);
                dc.FillRectangle(new SolidBrush(Color.Black), Angle2.X - 2, Angle2.Y - 2, 4, 4);
                dc.DrawLine(pen2, start_point, Angle1);
                dc.DrawLine(pen2, Angle2, end_point);
            }
        }