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);
            }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章