Ejemplo n.º 1
0
        private void menuItemInsertDecorLineOnClick(object Sender, System.EventArgs e)
        {
            LineSegment newDecorationLine = new LineSegment(new PointF(saveNewPosX, saveNewPosY), new PointF(saveNewPosX + decorationWidth, saveNewPosY));

            newDecorationLine.IsDecorationSegment = true;
            PolyLine newPolyLine = new PolyLine(newDecorationLine);

            outLines.Add(newPolyLine);
            newPolyLine.Changed += new OutlineChangeEventHandler(onContourChanged);
            changeContour(Sender);
        }
Ejemplo n.º 2
0
        private void menuItemInsertDecorBezierOnClick(object Sender, System.EventArgs e)
        {
            PointF pt0 = new PointF(saveNewPosX, saveNewPosY);
            PointF pt3 = new PointF(saveNewPosX + decorationWidth, saveNewPosY);

            BezierSegment newBezierSeg = new BezierSegment();

            newBezierSeg.IsDecorationSegment = true;
            newBezierSeg.points[0]           = pt0;
            newBezierSeg.points[1]           = new PointF((pt0.X + pt3.X) / 3, (pt0.Y + pt3.Y) / 3);
            newBezierSeg.points[2]           = new PointF((pt0.X + pt3.X) * 2 / 3, (pt0.Y + pt3.Y) * 2 / 3);
            newBezierSeg.points[3]           = pt3;

            PolyLine newPolyline = new PolyLine(newBezierSeg);

            outLines.Add(newPolyline);
            newPolyline.Changed += new OutlineChangeEventHandler(onContourChanged);
            changeContour(Sender);
        }
Ejemplo n.º 3
0
        public ThingEditorCtrl(GraphicThing graphicThing)
        {
            this.graphicThing = graphicThing;


            InitContextMenu();

            colorNormalSegment   = Color.FromArgb(220, 220, 255);
            backgrndColor        = Color.FromArgb(170, 170, 200);
            gridColor            = Color.Black;
            textAreaContourColor = Color.FromArgb(100, 180, 180, 100);
            mainContourColor     = Color.FromArgb(100, 220, 220, 255);
            dragging             = false;
            flagShowPoints       = true;
            flagShowGrid         = true;
            flagDefineTextArea   = false;
            distanceToLine       = 10;
            distanceToTextArea   = 10;
            decorationWidth      = 100;
            gridSize             = 16;
            saveGridSize         = gridSize;
            gridStyle            = EGridStyle.GrdLine;

            vScrollBar = null;
            hScrollBar = null;

            if (graphicThing != null)
            {
                outLines = new ArrayList();

                if (graphicThing.Elements.Count > 0)
                {
                    Contour elements = new Contour(graphicThing.FrameColor, graphicThing.Elements);
                    outLines.Add(elements);
                    elements.Changed += new OutlineChangeEventHandler(onContourChanged);
                }
                else
                {
                    outLines = new ArrayList();
                    Contour contour = new Contour(mainContourColor, gridSize);
                    outLines.Add(contour);
                    contour.Changed += new OutlineChangeEventHandler(onContourChanged);
                }

                if (graphicThing.Decorations.Count > 0)
                {
                    PolyLine polyLine = null;
                    foreach (Element element in graphicThing.Decorations)
                    {
                        if (element is Line)
                        {
                            if (polyLine == null)
                            {
                                polyLine = new PolyLine(element as Line);
                            }
                            else
                            {
                                if (!polyLine.Add(element as Line)) // couldn't add because ends don't connect, start a new one.
                                {
                                    outLines.Add(polyLine);
                                    polyLine.Changed += new OutlineChangeEventHandler(onContourChanged);
                                    polyLine          = new PolyLine(element as Line);
                                }
                            }
                        }
                    }
                    if (polyLine != null)
                    {
                        outLines.Add(polyLine);
                        polyLine.Changed += new OutlineChangeEventHandler(onContourChanged);
                    }
                }

                if (graphicThing.TextArea.Count > 0)
                {
                    Contour textArea = new Contour(graphicThing.FrameColor, graphicThing.TextArea);
                    outLines.Add(textArea);
                    textArea.Changed += new OutlineChangeEventHandler(onContourChanged);
                }
            }

            RectangleF tempRect = getBoundingRect();

            MinX = tempRect.Left;
            MinY = tempRect.Top;
            MaxX = tempRect.Right;
            MaxY = tempRect.Bottom;

            onShapeChanged(this, null);
        }
Ejemplo n.º 4
0
    public ThingEditorCtrl(GraphicThing graphicThing)
    {
      this.graphicThing = graphicThing;


      InitContextMenu();

      colorNormalSegment = Color.FromArgb(220, 220, 255);
      backgrndColor = Color.FromArgb(170, 170, 200);
      gridColor = Color.Black;
      textAreaContourColor = Color.FromArgb(100, 180, 180, 100);
      mainContourColor = Color.FromArgb(100, 220, 220, 255);
      dragging = false;
      flagShowPoints = true;
      flagShowGrid = true;
      flagDefineTextArea = false;
      distanceToLine = 10;
      distanceToTextArea = 10;
      decorationWidth = 100;
      gridSize = 16;
      saveGridSize = gridSize;
      gridStyle = EGridStyle.GrdLine;

      vScrollBar = null;
      hScrollBar = null;

      if (graphicThing != null)
      {
        outLines = new ArrayList();

        if (graphicThing.Elements.Count > 0)
        {
          Contour elements = new Contour(graphicThing.FrameColor, graphicThing.Elements);
          outLines.Add(elements);
          elements.Changed += new OutlineChangeEventHandler(onContourChanged);
        }
        else
        {
          outLines = new ArrayList();
          Contour contour = new Contour(mainContourColor, gridSize);
          outLines.Add(contour);
          contour.Changed += new OutlineChangeEventHandler(onContourChanged);
        }

        if (graphicThing.Decorations.Count > 0)
        {
          PolyLine polyLine = null;
          foreach (Element element in graphicThing.Decorations)
          {
            if (element is Line)
            {
              if (polyLine == null)
              {
                polyLine = new PolyLine(element as Line);
              }
              else
              {
                if (!polyLine.Add(element as Line)) // couldn't add because ends don't connect, start a new one.
                {
                  outLines.Add(polyLine);
                  polyLine.Changed += new OutlineChangeEventHandler(onContourChanged);
                  polyLine = new PolyLine(element as Line);
                }
              }
            }
          }
          if (polyLine != null)
          {
            outLines.Add(polyLine);
            polyLine.Changed += new OutlineChangeEventHandler(onContourChanged);
          }
        }

        if (graphicThing.TextArea.Count > 0)
        {
          Contour textArea = new Contour(graphicThing.FrameColor, graphicThing.TextArea);
          outLines.Add(textArea);
          textArea.Changed += new OutlineChangeEventHandler(onContourChanged);
        }
      }

      RectangleF tempRect = getBoundingRect();
      MinX = tempRect.Left;
      MinY = tempRect.Top;
      MaxX = tempRect.Right;
      MaxY = tempRect.Bottom;

      onShapeChanged(this, null);
    }
Ejemplo n.º 5
0
    private void menuItemInsertDecorBezierOnClick(object Sender, System.EventArgs e)
    {
      PointF pt0 = new PointF(saveNewPosX, saveNewPosY);
      PointF pt3 = new PointF(saveNewPosX + decorationWidth, saveNewPosY);

      BezierSegment newBezierSeg = new BezierSegment();
      newBezierSeg.IsDecorationSegment = true;
      newBezierSeg.points[0] = pt0;
      newBezierSeg.points[1] = new PointF((pt0.X + pt3.X) / 3, (pt0.Y + pt3.Y) / 3);
      newBezierSeg.points[2] = new PointF((pt0.X + pt3.X) * 2 / 3, (pt0.Y + pt3.Y) * 2 / 3);
      newBezierSeg.points[3] = pt3;

      PolyLine newPolyline = new PolyLine(newBezierSeg);
      outLines.Add(newPolyline);
      newPolyline.Changed += new OutlineChangeEventHandler(onContourChanged);
      changeContour(Sender);
    }
Ejemplo n.º 6
0
 private void menuItemInsertDecorLineOnClick(object Sender, System.EventArgs e)
 {
   LineSegment newDecorationLine = new LineSegment(new PointF(saveNewPosX, saveNewPosY), new PointF(saveNewPosX + decorationWidth, saveNewPosY));
     newDecorationLine.IsDecorationSegment = true;
   PolyLine newPolyLine = new PolyLine(newDecorationLine);
   outLines.Add(newPolyLine);
   newPolyLine.Changed += new OutlineChangeEventHandler(onContourChanged);
   changeContour(Sender);
 }