创建和投射矩形 Rectangle and RectangleF are useful features provided by IronDrawing which can be used to crop any image file. Customers using rectangles from System.Drawing.Rectangle or System.Drawing.RectangleF can also cast them to IronSoftware.Drawing.Rectangle and IronSoftware.Drawing.RectangleF using the Cast method. Create Rectangle & RectangleF To create a Rectangle, users can instantiate a new Rectangle and provide the X and Y coordinates, as well as the width and height measurement of the Rectangle in pixels. For example: Similarly, for the RectangleF class, a sample RectangleF object can be instantiated as follows: Cast Rectangle & RectangleF To cast an IronSoftware.Drawing.Rectangle from System.Drawing.Rectangle or an IronSoftware.Drawing.RectangleF from System.Drawing.RectangleF, you can use implicit conversion. Here's how you can do it: In this example, we use implicit conversion to cast System.Drawing.Rectangle and System.Drawing.RectangleF to their IronSoftware.Drawing counterparts, making it straightforward to utilize these rectangles in IronDrawing's features. 相关文档链接 在Github上查看 相关教程 相关操作指南 类文档 下载IronDrawing DLL 在此页面上报告问题 准备开始了吗? Nuget 下载 13,318,306 | 版本: 2025.3 刚刚发布 免费 NuGet 下载 总下载量:13,318,306 查看许可证