0
我想畫一個矩形的顏色(在我的情況下是黑色)彎曲的區域。如何用C#Winform中的顏色填充曲面區域?
我試過許多東西FillPie,FillEllipse函數在OnPaint事件,但沒能做到,我要畫這樣Fill Curved Area
我曾嘗試下面的代碼。但這不是我想要的
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics gr = e.Graphics;
int x = 50;
int y = 50;
int width = 100;
int height = 100;
Rectangle rect = new Rectangle(x, y, width/2, height/2);
gr.FillRectangle(Brushes.Black, rect);
gr.FillPie(Brushes.White, x, y, width, height, 180, 90);
using (Pen pen = new Pen(Color.Yellow, 1))
gr.DrawArc(pen, x, y, width, height, 180, 90);
}
這段代碼是這樣畫的。我不想創建額外的矩形。 MyCode