Пример #1
0
 public DrawPolygon(int x1, int y1, int x2, int y2, DrawingPens.PenType p)
 {
     pointArray = new ArrayList();
     pointArray.Add(new Point(x1, y1));
     pointArray.Add(new Point(x2, y2));
     DrawPen = DrawingPens.SetCurrentPen(p);
     PenType = p;
     LoadCursor();
     Initialize();
 }
Пример #2
0
 public DrawPoint(int x1, int y1, DrawingPens.PenType p)
 {
     Point.X = x1;
     Point.Y = y1;
     DrawPen = DrawingPens.SetCurrentPen(p);
     PenType = p;
     ZOrder  = 0;
     TipText = String.Format("Point @ {0}-{1}", x1, y1);
     Console.WriteLine(TipText);
     Initialize();
 }
Пример #3
0
 public DrawEllipse(int x, int y, int width, int height, DrawingPens.PenType pType, Color fillColor, bool filled)
 {
     Rectangle = new Rectangle(x, y, width, height);
     Center    = new Point(x + (width / 2), y + (height / 2));
     TipText   = String.Format("Ellipse Center @ {0}, {1}", Center.X, Center.Y);
     DrawPen   = DrawingPens.SetCurrentPen(pType);
     PenType   = pType;
     FillColor = fillColor;
     Filled    = filled;
     Initialize();
 }
Пример #4
0
 public DrawLine(int x1, int y1, int x2, int y2, DrawingPens.PenType p)
 {
     startPoint.X = x1;
     startPoint.Y = y1;
     endPoint.X   = x2;
     endPoint.Y   = y2;
     DrawPen      = DrawingPens.SetCurrentPen(p);
     PenType      = p;
     ZOrder       = 0;
     TipText      = String.Format("Line Start @ {0}-{1}, End @ {2}-{3}", x1, y1, x2, y2);
     Initialize();
 }
Пример #5
0
        public DrawConnector(int x1, int y1, int x2, int y2, DrawingPens.PenType p)
        {
            pointArray = new ArrayList();
            pointArray.Add(new Point(x1, y1));
            pointArray.Add(new Point(x2, y2));
            TipText = String.Format("Start @ {0}-{1}, End @ {2}, {3}", x1, y1, x2, y2);
            DrawPen = DrawingPens.SetCurrentPen(p);
            PenType = p;

            LoadCursor();
            Initialize();
        }
Пример #6
0
 public DrawRectangle(int x, int y, int width, int height, DrawingPens.PenType pType, Color fillColor, bool filled)
 {
     Center           = new Point(x + (width / 2), y + (height / 2));
     rectangle.X      = x;
     rectangle.Y      = y;
     rectangle.Width  = width;
     rectangle.Height = height;
     DrawPen          = DrawingPens.SetCurrentPen(pType);
     PenType          = pType;
     FillColor        = fillColor;
     Filled           = filled;
     TipText          = String.Format("Rectangle Center @ {0}, {1}", Center.X, Center.Y);
 }
Пример #7
0
        private void dashedArrowLineToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!CanControl)
            {
                CommandPointer();
                return;
            }

            lock (this) {
                DrawArea.PenType    = DrawingPens.PenType.DashedArrowPen;
                DrawArea.CurrentPen = DrawingPens.SetCurrentPen(DrawingPens.PenType.DashedArrowPen);
            }
        }
Пример #8
0
        private void greenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!CanControl)
            {
                CommandPointer();
                return;
            }

            lock (this) {
                if (checked2 != null)
                {
                    checked2.Checked = false;
                }
                greenToolStripMenuItem.Checked = true;
                checked2 = greenToolStripMenuItem;

                DrawArea.PenType    = DrawingPens.PenType.GreenPen;
                DrawArea.CurrentPen = DrawingPens.SetCurrentPen(DrawingPens.PenType.GreenPen);
            }
        }
Пример #9
0
        /// <summary>
        /// Load object from serialization stream
        /// </summary>
        /// <param name="info">Data from disk to parse into an object</param>
        /// <param name="orderNumber">Index of the layer object resides on</param>
        /// <param name="objectData">Index of the object on the layer</param>
        public virtual void LoadFromStream(SerializationInfo info, int orderNumber, int objectData)
        {
            int n = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}-{2}",
                              entryColor, orderNumber, objectData));

            Color = Color.FromArgb(n);

            PenWidth = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}-{2}",
                              entryPenWidth, orderNumber, objectData));

            PenType = (DrawingPens.PenType)info.GetValue(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}-{2}",
                              entryPen, orderNumber, objectData),
                typeof(DrawingPens.PenType));

            BrushType = (FillBrushes.BrushType)info.GetValue(
                string.Format(CultureInfo.InvariantCulture,
                              "{0}{1}-{2}",
                              entryBrush, orderNumber, objectData),
                typeof(FillBrushes.BrushType));

            n = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}-{2}",
                              entryFillColor, orderNumber, objectData));

            FillColor = Color.FromArgb(n);

            Filled = info.GetBoolean(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}-{2}",
                              entryFilled, orderNumber, objectData));

            ZOrder = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}-{2}",
                              entryZOrder, orderNumber, objectData));

            Rotation = info.GetInt32(
                String.Format(CultureInfo.InvariantCulture,
                              "{0}{1}-{2}",
                              entryRotation, orderNumber, objectData));

            tipText = info.GetString(String.Format(CultureInfo.InvariantCulture,
                                                   "{0}{1}-{2}",
                                                   entryTipText, orderNumber, objectData));

            // Set the Pen and the Brush, if defined
            if (PenType != DrawingPens.PenType.Generic)
            {
                DrawPen = DrawingPens.SetCurrentPen(PenType);
            }
            if (BrushType != FillBrushes.BrushType.NoBrush)
            {
                DrawBrush = FillBrushes.SetCurrentBrush(BrushType);
            }
        }
Пример #10
0
 private void dashedArrowLineToolStripMenuItem_Click(object sender, EventArgs e)
 {
     drawArea.PenType    = DrawingPens.PenType.DashedArrowPen;
     drawArea.CurrentPen = DrawingPens.SetCurrentPen(DrawingPens.PenType.DashedArrowPen);
 }
Пример #11
0
 private void redDotDashToolStripMenuItem_Click(object sender, EventArgs e)
 {
     drawArea.PenType    = DrawingPens.PenType.RedDotDashPen;
     drawArea.CurrentPen = DrawingPens.SetCurrentPen(DrawingPens.PenType.RedDotDashPen);
 }
Пример #12
0
 private void greenToolStripMenuItem_Click(object sender, EventArgs e)
 {
     drawArea.PenType    = DrawingPens.PenType.GreenPen;
     drawArea.CurrentPen = DrawingPens.SetCurrentPen(DrawingPens.PenType.GreenPen);
 }
Пример #13
0
 private void toolStripMenuItemGenericPen_Click(object sender, EventArgs e)
 {
     drawArea.PenType    = DrawingPens.PenType.Generic;
     drawArea.CurrentPen = DrawingPens.SetCurrentPen(DrawingPens.PenType.Generic);
 }