The following code example uses the
Note |
---|
GDI+ is included with WindowsВ XP and is available as a redistributable for WindowsВ NT 4.0 SP 6, WindowsВ 2000, WindowsВ 98, and WindowsВ Me. To download the latest redistributable, see |
Example
В | Copy Code |
---|---|
#using <system.drawing.dll> using namespace System; using namespace System::Drawing; // ... protected: Void Form1::OnPaint(PaintEventArgs^ pe ) { Graphics^ g = pe->Graphics; g->Clear(Color::AntiqueWhite); Rectangle rect = Form::ClientRectangle; Rectangle smallRect; smallRect.X = rect.X + rect.Width / 4; smallRect.Y = rect.Y + rect.Height / 4; smallRect.Width = rect.Width / 2; smallRect.Height = rect.Height / 2; Pen^ redPen = gcnew Pen(Color::Red); redPen->Width = 4; g->DrawLine(redPen, 0, 0, rect.Width, rect.Height); Pen^ bluePen = gcnew Pen(Color::Blue); bluePen->Width = 10; g->DrawArc( bluePen, smallRect, 90, 270 ); } |