Alsing.Windows.Forms.SyntaxBox.EditViewControl.IsOverSelection C# (CSharp) Method

IsOverSelection() public method

Returns if a specified pixel position is over the current selection.
public IsOverSelection ( int x, int y ) : bool
x int X Position in pixels
y int Y Position in pixels
return bool
        public bool IsOverSelection(int x, int y)
        {
            TextPoint p = Painter.CharFromPixel(x, y);

            if (p.Y >= Selection.LogicalBounds.FirstRow && p.Y <=
                                                           Selection.LogicalBounds.LastRow && Selection.IsValid)
            {
                if (p.Y > Selection.LogicalBounds.FirstRow && p.Y <
                                                              Selection.LogicalBounds.LastRow && Selection.IsValid)
                    return true;
                if (p.Y == Selection.LogicalBounds.FirstRow &&
                    Selection.LogicalBounds.FirstRow ==
                    Selection.LogicalBounds.LastRow)
                {
                    if (p.X >= Selection.LogicalBounds.FirstColumn && p.X <=
                                                                      Selection.LogicalBounds.LastColumn)
                        return true;
                    return false;
                }
                if (p.X >= Selection.LogicalBounds.FirstColumn && p.Y ==
                                                                  Selection.LogicalBounds.FirstRow)
                    return true;
                if (p.X <= Selection.LogicalBounds.LastColumn && p.Y ==
                                                                 Selection.LogicalBounds.LastRow)
                    return true;
                return false;
            }

            return false;
            //no chance we are over Selection.LogicalBounds
        }