Revit.SDK.Samples.CurtainWallGrid.CS.GridDrawing.AddDashVLine C# (CSharp) Метод

AddDashVLine() публичный Метод

show the candicate new V grid line to be added. In "add vertical grid line" operation, there'll be a dash line following the movement of the mouse, it's drawn by this method
public AddDashVLine ( System mousePosition ) : bool
mousePosition System /// the location of the mouse cursor ///
Результат bool
        public bool AddDashVLine(System.Drawing.Point mousePosition)
        {
            bool mouseInGrid = VerifyMouseLocation(mousePosition);

             // mouse is outside the curtain grid boundary
             if (false == mouseInGrid)
             {
            m_mouseLocationValid = false;
            return false;
             }

             // if the mouse laps over another grid line, it's invalid
             bool isOverlapped = IsOverlapped(mousePosition, m_vLinePathList);
             if (true == isOverlapped)
             {
            m_mouseLocationValid = false;
            string msg = "It's not allowed to add grid line lapping over another grid line";
            m_myDocument.Message = new KeyValuePair<string, bool>(msg, true);
            return false;
             }
             // there's no "overlap", it's valid
             else
             {
            string msg = "Specify a point within the curtain grid to locate the grid line";
            m_myDocument.Message = new KeyValuePair<string, bool>(msg, false);
             }

             m_mouseLocationValid = true;
             // get a parallel V line first
             GridLine2D vLine2D;
             // for "Curtain Wall: Curtain Wall 1", there's no initial U/V grid lines, so we use the boundary
             // line instead (the same result)
             if (null == m_vGridLines2D || 0 == m_vGridLines2D.Count)
             {
            vLine2D = m_boundLines2D[1];
             }
             else
             {
            vLine2D = m_vGridLines2D[0];
             }
             System.Drawing.Point startPoint = vLine2D.StartPoint;
             System.Drawing.Point endPoint = vLine2D.EndPoint;

             // move the start point and the end point parallelly
             startPoint.X = mousePosition.X;
             endPoint.X = mousePosition.X;
             // get the dash u line
             GridLine2D dashVLine = new GridLine2D(startPoint, endPoint);

             // initialize the pan
             Pen redPen = new Pen(System.Drawing.Color.Red, m_sketchPenWidth);
             Brush brush = Brushes.Red;
             redPen.DashCap = DashCap.Flat;
             redPen.DashStyle = DashStyle.Dash;

             // add the dash line to the assistant line list for drawing
             m_drawObject = new DrawObject(dashVLine, redPen);
             return true;
        }