annotate SilverlightGlimpse/SilverFlow.Controls/Extensions/GeometryExtensions.cs @ 64:ba89e36631bc

Latest version
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sun, 22 Apr 2012 14:20:52 +0100
parents 536498832a79
children
rev   line source
63
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
1 using System;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
2 using System.Windows;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
3 using SilverFlow.Geometry;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
4
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
5 namespace SilverFlow.Controls.Extensions
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
6 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
7 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
8 /// Geometry extensions
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
9 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
10 public static class GeometryExtensions
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
11 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
12 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
13 /// Rounds the specified point to the nearest integer coordinates.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
14 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
15 /// <param name="point">The point to round coordinates.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
16 /// <returns>New point with rounded coordinates.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
17 public static Point Round(this Point point)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
18 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
19 return new Point(Math.Round(point.X), Math.Round(point.Y));
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
20 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
21
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
22 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
23 /// Ensures that coordinates are positive.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
24 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
25 /// <param name="point">The point.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
26 /// <returns>Point with positive coordinates.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
27 public static Point EnsurePositive(this Point point)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
28 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
29 return new Point()
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
30 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
31 X = (point.X < 0) ? 0 : point.X,
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
32 Y = (point.Y < 0) ? 0 : point.Y
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
33 };
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
34 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
35
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
36 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
37 /// Gets position of the specified rectangle.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
38 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
39 /// <param name="rect">Rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
40 /// <returns>Upper left corner of the rectangle.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
41 public static Point Position(this Rect rect)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
42 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
43 return new Point(rect.X, rect.Y);
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
44 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
45
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
46 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
47 /// Gets position the lower right corner of the rectangle.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
48 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
49 /// <param name="rect">Rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
50 /// <returns>Lower right corner of the rectangle.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
51 public static Point BottomRight(this Rect rect)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
52 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
53 return new Point(rect.Right, rect.Bottom);
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
54 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
55
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
56 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
57 /// Gets position the lower left corner of the rectangle.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
58 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
59 /// <param name="rect">Rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
60 /// <returns>Lower left corner of the rectangle.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
61 public static Point BottomLeft(this Rect rect)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
62 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
63 return new Point(rect.X, rect.Bottom);
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
64 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
65
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
66 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
67 /// Gets position the upper right corner of the rectangle.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
68 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
69 /// <param name="rect">Rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
70 /// <returns>Upper right corner of the rectangle.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
71 public static Point TopRight(this Rect rect)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
72 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
73 return new Point(rect.Right, rect.Y);
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
74 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
75
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
76 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
77 /// Ensures that coordinates of the point are in the specified bounds.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
78 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
79 /// <param name="point">The point.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
80 /// <param name="bounds">The bounds.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
81 /// <returns>Point within the boinds.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
82 public static Point EnsureInBounds(this Point point, Rect bounds)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
83 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
84 return new Point()
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
85 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
86 X = point.X.EnsureInRange(bounds.X, bounds.Right),
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
87 Y = point.Y.EnsureInRange(bounds.Y, bounds.Bottom)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
88 };
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
89 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
90
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
91 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
92 /// Ensures that the X-coordinate of the point is in the specified horizontal bounds.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
93 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
94 /// <param name="point">The point.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
95 /// <param name="bounds">The bounds.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
96 /// <returns>Point with the X-coordinate within the boinds.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
97 public static Point EnsureInHorizontalBounds(this Point point, Rect bounds)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
98 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
99 return new Point()
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
100 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
101 X = point.X.EnsureInRange(bounds.X, bounds.Right),
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
102 Y = point.Y
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
103 };
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
104 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
105
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
106 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
107 /// Ensures that the Y-coordinate of the point is in the specified vertical bounds.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
108 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
109 /// <param name="point">The point.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
110 /// <param name="bounds">The bounds.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
111 /// <returns>Point with the Y-coordinate within the boinds.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
112 public static Point EnsureInVerticalBounds(this Point point, Rect bounds)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
113 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
114 return new Point()
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
115 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
116 X = point.X,
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
117 Y = point.Y.EnsureInRange(bounds.Y, bounds.Bottom)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
118 };
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
119 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
120
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
121 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
122 /// Determines whether coordinates of the point are Not a Number (NaN).
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
123 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
124 /// <param name="point">The point.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
125 /// <returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
126 /// <c>true</c> if coordinates are not specified; otherwise, <c>false</c>.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
127 /// </returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
128 public static bool IsNotSet(this Point point)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
129 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
130 return double.IsNaN(point.X) || double.IsNaN(point.Y);
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
131 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
132
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
133 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
134 /// Adds an offset to the specified point.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
135 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
136 /// <param name="point">The point.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
137 /// <param name="x">Distance along X-coordinate.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
138 /// <param name="y">Distance along Y-coordinate.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
139 /// <returns>New point.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
140 public static Point Add(this Point point, double x, double y)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
141 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
142 return new Point(point.X + x, point.Y + y);
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
143 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
144
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
145 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
146 /// Adds an offset specified by the Size to the specified point.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
147 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
148 /// <param name="point">The point.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
149 /// <param name="size">Distance to add.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
150 /// <returns>New point</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
151 public static Point Add(this Point point, Size size)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
152 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
153 return new Point(point.X + size.Width, point.Y + size.Height);
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
154 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
155
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
156 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
157 /// Determines whether dimensions are Not a Number (NaN).
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
158 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
159 /// <param name="size">The size.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
160 /// <returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
161 /// <c>true</c> if dimensions are not specified; otherwise, <c>false</c>.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
162 /// </returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
163 public static bool IsNotSet(this Size size)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
164 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
165 return double.IsNaN(size.Width) || double.IsNaN(size.Height);
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
166 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
167
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
168 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
169 /// Increments size to the specified values.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
170 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
171 /// <param name="size">The size.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
172 /// <param name="x">Increment by X-coordinate.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
173 /// <param name="y">Increment by Y-coordinate.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
174 /// <returns>New size.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
175 public static Size Add(this Size size, double x, double y)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
176 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
177 double width = size.Width + x;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
178 double height = size.Height + y;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
179
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
180 return new Size()
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
181 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
182 Width = width < 0 ? 0 : width,
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
183 Height = height < 0 ? 0 : height
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
184 };
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
185 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
186
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
187 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
188 /// Increases size if the rectangle to the specified width and height.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
189 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
190 /// <param name="rect">The rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
191 /// <param name="width">Value to add to the width of the rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
192 /// <param name="height">Value to add to the height of the rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
193 /// <returns>New rectangle.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
194 public static Rect Add(this Rect rect, double width, double height)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
195 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
196 return new Rect
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
197 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
198 X = rect.X,
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
199 Y = rect.Y,
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
200 Width = Math.Max(0, rect.Width + width),
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
201 Height = Math.Max(0, rect.Height + height)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
202 };
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
203 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
204
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
205 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
206 /// Shifts the point to the specified distance.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
207 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
208 /// <param name="point">The point.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
209 /// <param name="distance">The distance.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
210 /// <returns>Point shifted to the specified distance.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
211 public static Point Add(this Point point, Distance distance)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
212 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
213 return new Point()
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
214 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
215 X = distance.X.IsNotSet() ? point.X : point.X + distance.X,
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
216 Y = distance.Y.IsNotSet() ? point.Y : point.Y + distance.Y
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
217 };
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
218 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
219
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
220 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
221 /// Tests whether the rectangle overlaps with another one vertically.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
222 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
223 /// <param name="rect">The rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
224 /// <param name="testRect">Test rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
225 /// <param name="accuracy">Accuracy.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
226 /// <returns><c>true</c> if overlaps vertically; otherwise, <c>false</c>.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
227 public static bool OverlapsVertically(this Rect rect, Rect testRect, double accuracy = 0)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
228 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
229 double y1 = rect.Y + rect.Height - 1;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
230 double y2 = testRect.Y + testRect.Height - 1;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
231
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
232 if (rect.Y <= testRect.Y)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
233 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
234 return y1 >= (testRect.Y - accuracy);
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
235 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
236 else if (rect.Y <= (y2 + accuracy))
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
237 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
238 return true;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
239 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
240
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
241 return false;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
242 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
243
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
244 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
245 /// Tests whether the rectangle overlaps with another one horizontally.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
246 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
247 /// <param name="rect">The rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
248 /// <param name="testRect">Test rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
249 /// <param name="accuracy">Accuracy.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
250 /// <returns><c>true</c> if overlaps horizontally; otherwise, <c>false</c>.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
251 public static bool OverlapsHorizontally(this Rect rect, Rect testRect, double accuracy = 0)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
252 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
253 double x1 = rect.X + rect.Width - 1;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
254 double x2 = testRect.X + testRect.Width - 1;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
255
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
256 if (rect.X <= testRect.X)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
257 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
258 return x1 >= (testRect.X - accuracy);
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
259 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
260 else if (rect.X <= (x2 + accuracy))
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
261 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
262 return true;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
263 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
264
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
265 return false;
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
266 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
267
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
268 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
269 /// Tests whether the point overlaps with the rectangle vertically.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
270 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
271 /// <param name="point">Test point.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
272 /// <param name="rect">Test rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
273 /// <param name="accuracy">Accuracy.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
274 /// <returns><c>true</c> if overlaps vertically; otherwise, <c>false</c>.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
275 public static bool OverlapsVertically(this Point point, Rect rect, double accuracy = 0)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
276 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
277 return (point.Y >= (rect.Y - accuracy) && point.Y <= (rect.Y + rect.Height - 1 + accuracy));
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
278 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
279
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
280 /// <summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
281 /// Tests whether the point overlaps with the rectangle horizontally.
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
282 /// </summary>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
283 /// <param name="point">Test point.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
284 /// <param name="rect">Test rectangle.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
285 /// <param name="accuracy">Accuracy.</param>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
286 /// <returns><c>true</c> if overlaps horizontally; otherwise, <c>false</c>.</returns>
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
287 public static bool OverlapsHorizontally(this Point point, Rect rect, double accuracy = 0)
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
288 {
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
289 return (point.X >= (rect.X - accuracy) && point.X <= (rect.X + rect.Width - 1 + accuracy));
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
290 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
291 }
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
292 }