C#实现中间挖空的矩形,中间透明的矩形

       using (SolidBrush brush = new SolidBrush(Color.FromArgb(125, Color.Black)))
            {
                GraphicsPath path = new GraphicsPath();
                path.AddRectangle(pnlCut.Bounds);//添加要填充的矩形
                Region region = new Region(path);
                region.Exclude(_cellRect);//除去中间不需要填充的矩形
                g.FillRegion(brush, region);
            }

 

posted @ 2023-06-20 18:23  卡萨丁·周  阅读(121)  评论(0编辑  收藏  举报