![]() If there is no intersection, an empty Rectangle is returned.ĭetermines if this rectangle intersects with rect.Īdjusts the location of this rectangle by the specified amount.Ĭonverts the specified RectangleF to a Rectangle by rounding the RectangleF values to the nearest integer values.Ĭonverts the attributes of this Rectangle to a human-readable string.Ĭonverts the specified RectangleF to a Rectangle by truncating the RectangleF values. Returns a third Rectangle structure that represents the intersection of two other Rectangle structures. Replaces this Rectangle with the intersection of itself and the specified Rectangle. The original Rectangle structure remains unmodified. The copy is enlarged by the specified amount. Įnlarges this Rectangle by the specified amount.Ĭreates and returns an enlarged copy of the specified Rectangle structure. For information about the use of hash codes, see GetHashCode(). Returns the hash code for this Rectangle structure. ![]() Indicates whether the current object is equal to another object of the same type.Ĭreates a Rectangle structure with the specified edge locations. Tests whether obj is a Rectangle structure with the same location and size of this Rectangle structure. Gets or sets the y-coordinate of the upper-left corner of this Rectangle structure.Ĭonverts the specified RectangleF structure to a Rectangle structure by rounding the RectangleF values to the next higher integer values.ĭetermines if the specified point is contained within this Rectangle structure.ĭetermines if the rectangular region represented by rect is entirely contained within this Rectangle structure. Gets or sets the x-coordinate of the upper-left corner of this Rectangle structure. Gets or sets the width of this Rectangle structure. Gets the y-coordinate of the top edge of this Rectangle structure. Gets the x-coordinate that is the sum of X and Width property values of this Rectangle structure. Gets or sets the coordinates of the upper-left corner of this Rectangle structure. Gets the x-coordinate of the left edge of this Rectangle structure. Tests whether all numeric properties of this Rectangle have values of zero. Gets or sets the height of this Rectangle structure. Gets the y-coordinate that is the sum of the Y and Height property values of this Rectangle structure. Represents a Rectangle structure with its properties left uninitialized. Initializes a new instance of the Rectangle class with the specified location and size. The Graphics object provides the FillRectangle method and the Brush object provides the color and fill information.įor more advanced shapes, use a Region object. To draw a Rectangle filled with color, you need a Graphics object and an object derived from Brush such as SolidBrush or LinearGradientBrush. The units the rectangle is drawn in is determined by the PageUnit and PageScale properties of the graphics object used for drawing. The Graphics object provides the DrawRectangle method, and the Pen object stores features of the line, such as color and width. To draw rectangles, you need a Graphics object and a Pen object. Pen blackPen = new Pen(Color.FromArgb(255, 0, 0, 0), 5) Į.Graphics.DrawRectangle(blackPen, 10, 10, 100, 50) ĭim blackPen As New Pen(Color.FromArgb(255, 0, 0, 0), 5)Į.Graphics.DrawRectangle(blackPen, 10, 10, 100, 50)Ī rectangle is defined by its Width, Height, and upper-left corner represented by the Location property. The example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The enlarged view of the upper-left corner of the rectangle shows that the thick black lines are centered on those dotted lines. The dotted lines show where the rectangle would have been drawn if the pen width had been one pixel. The following illustration shows the resulting rectangle. For more details on pen alignment, see How to: Set Pen Width and Alignment. Because the pen width is 5, the sides of the rectangle are drawn 5 pixels wide, such that 1 pixel is drawn on the boundary itself, 2 pixels are drawn on the inside, and 2 pixels are drawn on the outside. When the rectangle is drawn, the pen is centered on the rectangle's boundary. ![]() The second argument passed to the Pen constructor indicates that the pen width is 5 pixels. The rectangle has a width of 100 and a height of 50. The following example draws a rectangle with its upper-left corner at (10, 10). Implements IEquatable(Of Rectangle) Public Structure Rectangle Inheritance Type Rectangle = struct Public Structure Rectangle ![]() Type Rectangle = struct type Rectangle = struct Public struct Rectangle : IEquatable public struct Rectangle public struct Rectangle : IEquatable public value class Rectangle : IEquatable public value class Rectangle Stores a set of four integers that represent the location and size of a rectangle.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |