4
System.Drawing中:.NET繪圖:縮放筆問題
我發現了一個post(無答案)是非常漂亮,說明我的問題。
我無法控制圖形轉換的Pen寬度。它可以是1個像素,也可以達到50個左右。我無法在兩者之間設置任何東西。一切看起來都是正確的,除了我想設置從1到6像素的筆寬。
// ScaleTransform pen to the reverse of the graphics transform. This works.
float scaleX = gridRectangle_logical.Width/gridRectangle_device.Width;
float scaleY = gridRectangle_logical.Height/gridRectangle_device.Height;
Pen pen = new Pen(Color.Black, 4); // problem here.
pen.ScaleTransform(scaleX, scaleY);