Please use. NET 5,. NET 6, NET 7,. NET 8, NET Framework 4.6, NET Framework 4.61, NET Framework 4.7, NET Framework 4.72, NET Framework 4.8, NET Framework 4.81, and. NET Core 3.1 versions

RectF 结构

Represents a rectangle structure with single-precision floating-point coordinates and dimensions 表示具有单精度浮点坐标和尺寸的矩形结构

Definition

命名空间: DeploySharp.Data
程序集: DeploySharp (在 DeploySharp.dll 中) 版本:0.0.4+6e8a2e904469617cd59619d666c0e272985c0e33
C#
public struct RectF : IEquatable<RectF>
Inheritance
Object    ValueType    RectF
Implements
IEquatableRectF

备注

This structure is immutable and provides various operations for rectangle manipulation. 该结构是不可变的,并提供各种矩形操作功能。

The coordinate system assumes Y increases downward and X increases rightward. 坐标系假定Y向下增加,X向右增加。

构造函数

RectF(PointF, SizeF) Initializes a new instance of the RectF structure from location and size 从位置和大小初始化RectF结构的新实例
RectF(Single, Single, Single, Single) Represents a rectangle structure with single-precision floating-point coordinates and dimensions 表示具有单精度浮点坐标和尺寸的矩形结构

属性

Bottom Gets the y-coordinate of the bottom edge (readonly) 获取底部边缘的y坐标(只读)
BottomRight Gets the coordinates of the bottom-right corner (readonly) 获取右下角的坐标(只读)
Left Gets or sets the x-coordinate of the left edge 获取或设置左侧边缘的x坐标
Location Gets or sets the location (top-left corner) of the rectangle 获取或设置矩形的位置(左上角)
Right Gets the x-coordinate of the right edge (readonly) 获取右侧边缘的x坐标(只读)
Size Gets or sets the size of the rectangle 获取或设置矩形的大小
Top Gets or sets the y-coordinate of the top edge 获取或设置顶部边缘的y坐标
TopLeft Gets the coordinates of the top-left corner (readonly) 获取左上角的坐标(只读)

方法

Add(PointF) Translates this rectangle by the specified point 将此矩形平移指定点
Add(SizeF) Adds the specified size to this rectangle 将指定大小添加到此矩形
Contains(PointF) Determines if the specified point is contained within this rectangle 确定指定点是否包含在此矩形内
Contains(RectF) Determines if the specified rectangle is entirely contained within this rectangle 确定指定矩形是否完全包含在此矩形内
Contains(Single, Single) Determines if the specified point is contained within this rectangle 确定指定点是否包含在此矩形内
Equals Determines if this rectangle equals another rectangle 确定此矩形是否等于另一个矩形
FromLTRB Creates a RectF from edge coordinates (left, top, right, bottom) 从边缘坐标(左、上、右、下)创建RectF
GetTypeGets the Type of the current instance.
(继承自 Object。)
Inflate(SizeF) Expands or shrinks the rectangle by the specified size 按指定大小扩展或收缩矩形
Inflate(Single, Single) Expands or shrinks the rectangle by the specified amount 按指定量扩展或收缩矩形
Inflate(Rect, Int32, Int32) Creates a rectangle that results from expanding the specified rectangle 创建通过扩展指定矩形而产生的新矩形
Intersect(RectF) Computes the intersection between this rectangle and another 计算此矩形与另一个矩形的交集
Intersect(RectF, RectF) Computes the intersection of two rectangles 计算两个矩形的交集
IntersectsWith Determines if this rectangle intersects with another rectangle 确定此矩形是否与另一个矩形相交
Subtract(PointF) Translates this rectangle inversely by the specified point 将此矩形反向平移指定点
Subtract(SizeF) Subtracts the specified size from this rectangle 从此矩形中减去指定大小
ToString Returns a string representation of the rectangle 返回矩形的字符串表示形式
(重写 ValueTypeToString)
Union(RectF) Computes the smallest rectangle that contains both this rectangle and another 计算包含此矩形和另一个矩形的最小矩形
Union(RectF, RectF) Computes the smallest rectangle that contains both rectangles 计算包含两个矩形的最小矩形

运算符

Addition(RectF, PointF) Translates a rectangle by the specified point 通过指定点平移矩形
Addition(RectF, SizeF) Adds the specified size to the rectangle 将指定大小添加到矩形
BitwiseAnd(RectF, RectF) 
BitwiseOr(RectF, RectF) Computes the union of two rectangles using bitwise OR operator (|) 使用按位OR运算符(|)计算两个矩形的并集
Subtraction(RectF, PointF) Translates a rectangle inversely by the specified point 通过指定点反向平移矩形
Subtraction(RectF, SizeF) Subtracts the specified size from the rectangle 从矩形中减去指定大小

字段

Height The height of the rectangle 矩形的高度
Width The width of the rectangle 矩形的宽度
X The x-coordinate of the rectangle's origin (left edge) 矩形原点的x坐标(左边缘)
Y The y-coordinate of the rectangle's origin (top edge) 矩形原点的y坐标(上边缘)

参见