Post Views: 189
แนะนำวิธีการสร้างรูปภาพลายเซ็นโดยวิธีการพิมพ์ข้อความ

วิธีการเตรียมฟอนต์
1) เข้าเว็บไซต์ https://www.f0nt.com/release/worasait/
2) ดาวน์โหลด ฟอนต์ Worasait (worasait.ttf)
วิธีการเขียน Code
1) ติดตั้ง NuGet ชื่อ System.Drawing.Common
2) สร้าง Folder ชื่อ files สำหรับเก็บไฟล์ฟอนต์ ในกรณีนี้อยู่ใน (wwwroot/files/worasait.ttf)

3) สร้าง Razor Component ชื่อ SignatureType.razor ในกรณีนี้อยู่ใน (Pages/SignatureType.razor)
4) จากนั้นเขียน Code ดังนี้


5) ผลลัพธ์จากการสร้างรูปภาพลายเซ็นโดยวิธีการพิมพ์ข้อความ

หมายเหตุ: วิธีการเปลี่ยนสีภาพลายเซ็น
1) graphics.DrawString(Txt, oFont, Brushes.Black, 0, 0);
2) เปลี่ยนจาก Brushes.Black เป็นสีที่ต้องการ เช่น Brushes.Red เป็นต้น