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

SelectULine() public method

pick up a U grid line by mouse
public SelectULine ( 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 SelectULine(System.Drawing.Point mousePosition, bool verifyLock, bool verifyRemove)
        {
            for (int i = 0; i < m_uLinePathList.Count; i++)
             {
            GraphicsPath path = m_uLinePathList[i];
            GridLine2D line2D = m_uGridLines2D[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_selectedUIndex = 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_selectedUIndex = -1;
        }