|
![](/images/resource/spacer.gif) |
|
C# ไม่ทราบว่า เทียบค่าใน Graphics.draw ในหน่วย เซนติเมตร ได้ยังไง บ้างครับ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
มาอัพเดทนะครับ
ผมได้ลองใช้ PageUnit = GraphicsUnit.Millimeter;
Code (C#)
private void button4_Click(object sender, EventArgs e)
{
Graphics g = this.CreateGraphics();
int x1 = 50, x2 = x1+110,y1 = 20,y2 = 50; //y2-y1 = 30 mm
g.Clear(this.BackColor);
g.PageUnit = GraphicsUnit.Millimeter;
Pen drawingPen = new Pen(Brushes.Black, 1);
g.DrawLine(drawingPen, new Point(x1,y1), new Point(x1,y2));
//g.DrawLine(drawingPen, new Point(x1, y1), new Point(x2,y2));
//g.DrawLine(drawingPen, new Point(x1, y2), new Point(x2, y2));
}
ปรากฎว่าผลห่างจากความเป็นจริงเยอะครับ
![กะ้ด้ กะ้ด้](https://www.thaicreate.com/upload/stock/20210612154638.png?v=1001)
จากรูปผมได้ลากเส้น 3 cm โดยให้ y1 = 20,y2 = 50; //y2-y1 = 30 mm
แต่มันไม่ได้ 3 cm ตามต้องการครับ
ไม่ทราบว่าใครมีวิธีอีกไม๊ ครับ
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2021-06-12 15:47:33 |
By :
lamaka.tor |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 03
|