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
}