我應該使用什麼畫筆繪製矩形的白色內部矩形和矩形的周長線,如下面的立面圖。如何繪製一個看起來像CAD立面圖的矩形
form1 winform是我工作的,winform背後的圖像是我需要矩形來查看我的winform。
爲了使問題更容易,我怎樣才能用白色填充矩形的內部?
我如何用白色填充矩形的線條?我不需要填充矩形的內部,我需要用白色填充構成矩形的4條線的一部分。
void BuildShopDrawing(ElevationResponse elevation)
{
float penWidth = (float)((2f/12f) * PIXELS_PER_FOOT);
Pen blackPen = new Pen(Color.FromArgb(40, 84, 149), penWidth);
Bitmap canvas = new Bitmap((((int)elevation.TotalWidthFeet) * PIXELS_PER_FOOT) + 55, (((int)elevation.TotalHeightFeet) * PIXELS_PER_FOOT) + 25);
Graphics dc = Graphics.FromImage(canvas);
RectangleF[] bays = new RectangleF[elevation.Bays.Count];
float x = 10F;
float width = 0F;
float height = 0F;
for (int i = 0; i < elevation.Bays.Count; i++)
{
if (i > 0)
{
x += (float)((elevation.Bays[i - 1].WidthInches/12) * PIXELS_PER_FOOT);
}
width = (float)(elevation.Bays[i].WidthInches/12) * PIXELS_PER_FOOT;
height = (float)(elevation.Bays[i].HeightInches/12) * PIXELS_PER_FOOT;
bays[i] =
new RectangleF(new PointF(x, 10),
new SizeF(width, height));
}
dc.DrawRectangles(blackPen, bays);
this.picBx.Image = canvas;
this.Size = new System.Drawing.Size(canvas.Width + 10, canvas.Height + 50);
}
請編輯您的問題,這是不完全清楚你想要做什麼。如果你只是想用白色填充矩形,你可以直接調用dc.FillRectangles(Brushes.White,bay) – Mataniko