Esempio n. 1
0
        public static Polyline ConnectShapes(Shape Start, Shape End, Object Tag, Dataweb.NShape.WinFormsUI.Display Display,
                                             Dataweb.NShape.Project Project, ILineStyle LineStyle, Layer Layer)
        {
            Polyline arrow = (Polyline)Project.ShapeTypes["Polyline"].CreateInstance();

            arrow.LineStyle          = LineStyle;
            arrow.Tag                = Tag;
            arrow.SecurityDomainName = 'B';

            if (Display.InvokeRequired)
            {
                Display.BeginInvoke(new MethodInvoker(() => AddShape(Display, Project, arrow)));
            }
            else
            {
                Display.Diagram.Shapes.Add(arrow);
                Project.Repository.Insert((Shape)arrow, Display.Diagram);
            }

            arrow.Connect(ControlPointId.FirstVertex, Start, ControlPointId.Reference);
            arrow.Connect(ControlPointId.LastVertex, End, ControlPointId.Reference);

            Display.Diagram.AddShapeToLayers(arrow, Layer.Id);


            return(arrow);
        }
Esempio n. 2
0
        public static Shape DrawCircle(int Diameter, int X, int Y, IFillStyle FillStyle, ILineStyle LineStyle,
                                       String Caption, Object Tag, Char SecurityDomain, Dataweb.NShape.WinFormsUI.Display Display,
                                       Dataweb.NShape.Project Project, Layer Layer)
        {
            CircleBase shape;

            shape          = (CircleBase)Project.ShapeTypes["Circle"].CreateInstance();
            shape.Diameter = Diameter;

            shape.X = X;

            shape.Y = Y;

            shape.FillStyle = FillStyle;

            shape.SetCaptionText(0, Caption);

            shape.CharacterStyle = Project.Design.CharacterStyles.Heading3;

            shape.Tag = Tag;

            shape.SecurityDomainName = SecurityDomain;


            if (Display.InvokeRequired)
            {
                Display.BeginInvoke(new MethodInvoker(() => AddShape(Display, Project, shape)));
            }
            else
            {
                Display.Diagram.Shapes.Add(shape);
                Display.Diagram.AddShapeToLayers(shape, Layer.Id);

                Project.Repository.Insert((Shape)shape, Display.Diagram);
            }


            return(shape);
        }