ส่งออกแต่ละเลย์เอาต์ในไฟล์ PNG แยก
Contents
[
Hide
]วิธีการส่งออกแต่ละเลย์เอาต์ในไฟล์ PNG แยก
ปัญหา: วิธีการส่งออกแต่ละเลย์เอาต์ในไฟล์ PNG แยก
เคล็ดลับ: เพื่อทำเช่นนี้ คุณเพียงแค่ต้องไปผ่านทุกชั้นและดำเนินการเมธอด Save บนแต่ละชั้น
ตัวอย่าง:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using CadImage cadImage = (CadImage)Image.Load(fileName); | |
var rasterizationOptions = new CadRasterizationOptions(); | |
rasterizationOptions.PageSize = new SizeF(cadImage.Width, cadImage.Height); | |
CadLayoutDictionary layouts = cadImage.Layouts; | |
foreach (CadLayout layout in layouts.Values) | |
{ | |
rasterizationOptions.Layouts = new string[] { layout.LayoutName }; | |
ImageOptionsBase option = new PngOptions(); | |
option.VectorRasterizationOptions = rasterizationOptions; | |
cadImage.Save(layout.LayoutName + ".png", option); | |
} |