コード例 #1
0
        private void StartAddLink(ConnectorElement connStart, Point mousePoint)
        {
            if (document.Action == DesignerAction.Connect)
            {
                this.connStart = connStart;
                this.connEnd   = new ConnectorElement(connStart.ParentElement);

                connEnd.Location = connStart.Location;
                IMoveController ctrl = (IMoveController)((IControllable)connEnd).GetController();
                ctrl.Start(mousePoint);

                isAddLink = true;

                switch (document.LinkType)
                {
                case (LinkType.Straight):
                    linkLine = new StraightLinkElement(connStart, connEnd);
                    break;

                case (LinkType.RightAngle):
                    linkLine = new RightAngleLinkElement(connStart, connEnd);
                    break;
                }
                linkLine.Visible     = true;
                linkLine.BorderColor = Color.FromArgb(150, Color.Black);
                linkLine.BorderWidth = 1;

                this.Invalidate(linkLine, true);

                OnElementConnecting(new ElementConnectEventArgs(connStart.ParentElement, null, linkLine));
            }
        }
コード例 #2
0
        private void StartAddLink(ConnectorElement connStart, Point mousePoint)
        {
            if (document.Action == DesignerAction.Connect)
            {
                this.connStart = connStart;
                this.connEnd   = new ConnectorElement(connStart.ParentElement);

                connEnd.Location = connStart.Location;
                IMoveController ctrl = (IMoveController)((IControllable)connEnd).GetController();
                ctrl.Start(mousePoint);

                isAddLink = true;

                linkLine = CreateElementInstance(connStart, connEnd);

                this.Invalidate(linkLine, true);

                OnElementConnecting(new ElementConnectEventArgs(connStart.ParentElement, null, linkLine));
            }
        }