我有一个颜色图,想在图片图上应用网格尺寸。使用以下代码已成功完成此请求:
// draw mesh pattern
Pen transPen = new Pen(Color.FromArgb(128, 150, 150, 150),2);
g.DrawRectangle(transPen, (float)X,
(float)Y,
(float)dx,
(float)dy);
// draw contour square (brush , x , y , dx , dy)
g.FillRectangle(myContourBrush,
(float)X,
(float)Y,
(float)dx,
(float)dy);
现在我的问题是:第一个透明矩形是只在边界区域透明还是所有矩形区域都是透明的?我不想影响颜色图颜色,我只想拥有网格图案。
最佳答案
DrawRectangle
方法只绘制边。如果要填充它,则必须使用 FillRectangle
。拿个look为自己。您可能需要放大很多才能注意到颜色变化。
关于c# - 透明度如何在绘制矩形(边框或整个区域)(C#)中起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22085065/