コード例 #1
0
ファイル: RectangleF.cs プロジェクト: Gayo/Gayo-CAROT
 /// <summary>Replaces this <see cref="T:System.Drawing.RectangleF"></see> structure with the intersection of itself and the specified <see cref="T:System.Drawing.RectangleF"></see> structure.</summary>
 /// <returns>This method does not return a value.</returns>
 /// <param name="rect">The rectangle to intersect. </param>
 /// <filterpriority>1</filterpriority>
 public void Intersect(RectangleF rect)
 {
     RectangleF ef = Intersect(rect, this);
     this.X = ef.X;
     this.Y = ef.Y;
     this.Width = ef.Width;
     this.Height = ef.Height;
 }
コード例 #2
0
ファイル: RectangleF.cs プロジェクト: Gayo/Gayo-CAROT
 /// <summary>Determines if this rectangle intersects with rect.</summary>
 /// <returns>This method returns true if there is any intersection.</returns>
 /// <param name="rect">The rectangle to test. </param>
 /// <filterpriority>1</filterpriority>
 public bool IntersectsWith(RectangleF rect)
 {
     return ((((rect.X < (this.X + this.Width)) && (this.X < (rect.X + rect.Width))) && (rect.Y < (this.Y + this.Height))) && (this.Y < (rect.Y + rect.Height)));
 }
コード例 #3
0
ファイル: RectangleF.cs プロジェクト: Gayo/Gayo-CAROT
 /// <summary>Determines if the rectangular region represented by rect is entirely contained within this <see cref="T:System.Drawing.RectangleF"></see> structure.</summary>
 /// <returns>This method returns true if the rectangular region represented by rect is entirely contained within the rectangular region represented by this <see cref="T:System.Drawing.RectangleF"></see>; otherwise false.</returns>
 /// <param name="rect">The <see cref="T:System.Drawing.RectangleF"></see> to test. </param>
 /// <filterpriority>1</filterpriority>
 public bool Contains(RectangleF rect)
 {
     return ((((this.X <= rect.X) && ((rect.X + rect.Width) <= (this.X + this.Width))) && (this.Y <= rect.Y)) && ((rect.Y + rect.Height) <= (this.Y + this.Height)));
 }
コード例 #4
0
ファイル: RectangleF.cs プロジェクト: Gayo/Gayo-CAROT
 /// <summary>Creates the smallest possible third rectangle that can contain both of two rectangles that form a union.</summary>
 /// <returns>A third <see cref="T:System.Drawing.RectangleF"></see> structure that contains both of the two rectangles that form the union.</returns>
 /// <param name="a">A rectangle to union. </param>
 /// <param name="b">A rectangle to union. </param>
 /// <filterpriority>1</filterpriority>
 public static RectangleF Union(RectangleF a, RectangleF b)
 {
     float x = Math.Min(a.X, b.X);
     float num2 = Math.Max((float) (a.X + a.Width), (float) (b.X + b.Width));
     float y = Math.Min(a.Y, b.Y);
     float num4 = Math.Max((float) (a.Y + a.Height), (float) (b.Y + b.Height));
     return new RectangleF(x, y, num2 - x, num4 - y);
 }
コード例 #5
0
ファイル: RectangleF.cs プロジェクト: Gayo/Gayo-CAROT
 /// <summary>Returns a <see cref="T:System.Drawing.RectangleF"></see> structure that represents the intersection of two rectangles. If there is no intersection, and empty <see cref="T:System.Drawing.RectangleF"></see> is returned.</summary>
 /// <returns>A third <see cref="T:System.Drawing.RectangleF"></see> structure the size of which represents the overlapped area of the two specified rectangles.</returns>
 /// <param name="a">A rectangle to intersect. </param>
 /// <param name="b">A rectangle to intersect. </param>
 /// <filterpriority>1</filterpriority>
 public static RectangleF Intersect(RectangleF a, RectangleF b)
 {
     float x = Math.Max(a.X, b.X);
     float num2 = Math.Min((float) (a.X + a.Width), (float) (b.X + b.Width));
     float y = Math.Max(a.Y, b.Y);
     float num4 = Math.Min((float) (a.Y + a.Height), (float) (b.Y + b.Height));
     if ((num2 >= x) && (num4 >= y))
     {
         return new RectangleF(x, y, num2 - x, num4 - y);
     }
     return Empty;
 }
コード例 #6
0
ファイル: RectangleF.cs プロジェクト: Gayo/Gayo-CAROT
 static RectangleF()
 {
     Empty = new RectangleF();
 }
コード例 #7
0
ファイル: RectangleF.cs プロジェクト: Gayo/Gayo-CAROT
 /// <summary>Creates and returns an inflated copy of the specified <see cref="T:System.Drawing.RectangleF"></see> structure. The copy is inflated by the specified amount. The original rectangle remains unmodified.</summary>
 /// <returns>The inflated <see cref="T:System.Drawing.RectangleF"></see>.</returns>
 /// <param name="rect">The <see cref="T:System.Drawing.RectangleF"></see> to be copied. This rectangle is not modified. </param>
 /// <param name="y">The amount to inflate the copy of the rectangle vertically. </param>
 /// <param name="x">The amount to inflate the copy of the rectangle horizontally. </param>
 /// <filterpriority>1</filterpriority>
 public static RectangleF Inflate(RectangleF rect, float x, float y)
 {
     RectangleF ef = rect;
     ef.Inflate(x, y);
     return ef;
 }