Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> C#

Vẽ Ellipse (Elip) trong C#

Dùng method DrawEllipse() của object Graphics. Cần pen object và rectangle object.

Cần Windows Form để vẽ hình.

Thiết lập Graphics object:

Graphics g = this.CreateGraphics();

Pen object:

Pen p = new Pen(new SolidBrush(Color.Red), 15);

Rectangle object:

Rectangle r = new Rectangle(120, 60, 180, 180);

Vẽ ellipse:

g.DrawEllipse(p, r);