コード例 #1
0
ファイル: MoveLinkCmd.cs プロジェクト: jboenig/Diagram
        /// <summary>
        /// Moves the port on the link and optionally reconnects to a new
        /// port.
        /// </summary>
        /// <param name="cmdTarget">Unused</param>
        /// <returns>true if successful, otherwise false</returns>
        /// <remarks>
        /// First, any existing connections on the
        /// <see cref="Syncfusion.Windows.Forms.Diagram.MoveLinkCmd.LinkPort"/>
        /// are removed. Next, if the
        /// <see cref="Syncfusion.Windows.Forms.Diagram.MoveLinkCmd.Points"/>
        /// property is not null it is used to update link's vertices. And
        /// finally, the
        /// <see cref="Syncfusion.Windows.Forms.Diagram.MoveLinkCmd.LinkPort"/>
        /// is connected to the
        /// <see cref="Syncfusion.Windows.Forms.Diagram.MoveLinkCmd.TargetPort"/>.
        /// </remarks>
        public override bool Do(object cmdTarget)
        {
            bool success = false;

            if (this.link != null && this.linkPort != null)
            {
                this.link.DisconnectAll(this.linkPort);

                if (this.points != null)
                {
                    IServiceProvider linkSvcProvider = this.link as IServiceProvider;
                    if (linkSvcProvider != null)
                    {
                        IPoints ptsObj = linkSvcProvider.GetService(typeof(IPoints)) as IPoints;
                        if (ptsObj != null)
                        {
                            ptsObj.SetPoints(this.points);
                        }
                    }
                }

                if (this.targetPort != null)
                {
                    this.link.Connect(this.linkPort, this.targetPort);
                }
            }

            return(success);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: nhrbtk/lab_1
        private void projective_btn_Click(object sender, EventArgs e)
        {
            MyPoint xEnd       = new MyPoint((float)XE_x_nud.Value, (float)XE_y_nud.Value, true, (float)XE_w_nud.Value);
            MyPoint yEnd       = new MyPoint((float)YE_x_nud.Value, (float)YE_y_nud.Value, true, (float)YE_w_nud.Value);
            MyPoint startPoint = new MyPoint((float)X0_nud.Value, (float)Y0_nud.Value, true, (float)W0_nud.Value);

            if (draw.FigureExists())
            {
                figure.SetPoints(Transform.Projective(figure, startPoint, xEnd, yEnd));

                grid.SetPoints(Transform.Projective(grid, startPoint, xEnd, yEnd));

                draw.SetFigure(figure);
                draw.SetGrid(grid);

                showField.Image = draw.ShowDrawing();
            }
        }