Revit.SDK.Samples.CurtainWallGrid.CS.GridDrawing.SelectVLine C# (CSharp) Method

SelectVLine() public method

pick up a V grid line by mouse
public SelectVLine ( System mousePosition, bool verifyLock, bool verifyRemove ) : void
mousePosition System /// the location of the mouse cursor ///
verifyLock bool /// will locked grid lines be picked (if verifyLock is true, won't pick up locked ones) ///
verifyRemove bool /// whether grid line without skipped segments be picked (if verifyRemove is true, won't pick up the grid line without skipped segments) ///
return void
        public void SelectVLine(System.Drawing.Point mousePosition, bool verifyLock, bool verifyRemove)
        {
            for (int i = 0; i < m_vLinePathList.Count; i++)
             {
            GraphicsPath path = m_vLinePathList[i];
            GridLine2D line2D = m_vGridLines2D[i];
            // the verifyLock is true (won't pick up locked ones) and the current pointed grid line is locked
            // so can't select it
            if (true == verifyLock &&
                true == line2D.Locked)
            {
               continue;
            }

            // the verifyRemove is true (only pick up the grid line with skipped segments) and the current pointed grid line
            // has no skipped segments
            if (true == verifyRemove && line2D.RemovedNumber == 0)
            {
               continue;
            }

            Pen redPen = new Pen(System.Drawing.Color.Red, m_outlineSelectPenWidth);

            // the mouse is in the outline of the graphics path
            if (path.IsOutlineVisible(mousePosition, redPen))
            {
               m_selectedVIndex = i;
               m_drawObject = new DrawObject(line2D, new Pen(System.Drawing.Color.Red, m_selectedLinePenWidth));
               // show the lock status of the grid line
               if (false == verifyLock && false == verifyRemove)
               {
                  m_drawObject.Text = (true == line2D.Locked) ? "Locked" : "Unlocked";
                  m_drawObject.TextPosition = mousePosition;
                  m_drawObject.TextPen = redPen;
               }
               return;
            }
             }

             m_drawObject.Clear();
             m_selectedVIndex = -1;
        }