創建和轉換矩形 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 查看許可證