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

SizeF 结构

Represents a size with single-precision floating-point dimensions 表示具有单精度浮点尺寸的大小结构体

Definition

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

备注

Used for representing dimensions of rectangular areas with floating-point precision. Suitable for graphics operations, UI layout, and other scenarios requiring decimal values.

用于表示需要浮点精度的矩形区域尺寸。 适用于图形操作、UI布局等需要小数值的场景。

示例

Basic usage:
C#
var floatSize = new SizeF(100.5f, 200.75f);
Size intSize = floatSize.ToSize(); // Explicit conversion (truncates)
SizeF fromDouble = (SizeF)new SizeD(150.7, 250.3); // Explicit conversion

构造函数

SizeF(Double, Double) Initializes a new SizeF from double-precision values 从双精度值初始化新SizeF
SizeF(Single, Single) Represents a size with single-precision floating-point dimensions 表示具有单精度浮点尺寸的大小结构体

方法

GetTypeGets the Type of the current instance.
(继承自 Object。)
ToSize Converts to integer-based Size (truncates decimal portion) 转换为整数Size(截断小数部分)
ToSizeD Converts to double-precision SizeD 转换为双精度SizeD
ToString Returns a string representation of the size 返回大小的字符串表示形式
(重写 ValueTypeToString)

运算符

(SizeD to SizeF) Explicit conversion from double-precision SizeD 从双精度SizeD的显式转换
(Size to SizeF) Implicit conversion from integer-based Size 从整数Size的隐式转换

字段

Height Gets or sets the vertical dimension 获取或设置垂直尺寸
Width Gets or sets the horizontal dimension 获取或设置水平尺寸

参见