Class Geometry
Helper class for geometry related methods.
public static class Geometry
- Inheritance
-
Geometry
- Inherited Members
Methods
CalculateEnsureVisibleScrollPixels(Rectangle, Rectangle)
Calculates scroll pixels for EnsureVisible operations.
public static Point CalculateEnsureVisibleScrollPixels(Rectangle container, Rectangle item)
Parameters
Returns
- Point
The pixels the containers needs to be scrolled in order to make the item visible.
CalculateEnsureVisibleScrollPixels(Rectangle, Rectangle, bool)
Calculates scroll pixels for EnsureVisible operations.
public static Point CalculateEnsureVisibleScrollPixels(Rectangle container, Rectangle item, bool favorTopLeft)
Parameters
containerRectangleA container rectangle.
itemRectangleAn item rectangle.
favorTopLeftboolIf set to
true, the top-left corner of the item is made visible if the whole item cannot be made visible.
Returns
- Point
The pixels the containers needs to be scrolled in order to make the item visible.
CalculateEnsureVisibleScrollPixelsOnScreen(Rectangle)
Calculates scroll pixels for EnsureVisible operations in order to make the
item visible on the screen.
public static Point CalculateEnsureVisibleScrollPixelsOnScreen(Rectangle item)
Parameters
itemRectangleAn item rectangle.
Returns
- Point
The pixels a container needs to be scrolled in order to make the item visible on the screen. Note that if you move the container of the item (instead of scrolling), you have to subtract the returned point from the current location of the container.
MDist(Point, Point)
Calculates the Manhattan distance between two points.
public static double MDist(Point a, Point b)
Parameters
Returns
- double
The distance between a and b.
Normalize(Rectangle)
Normalizes the specified rectangle, i.e. ensures that both width and height are positive.
public static Rectangle Normalize(Rectangle rect)
Parameters
rectRectangleA rectangle.
Returns
- Rectangle
The normalized rectangle, i.e. a rectangle with positive width and height.