The following code example modifies the OnPaint event handler to retrieve a pointer to the
The image is represented by the
The Graphics and Image classes are both in the
![]() |
---|
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
В | ![]() |
---|---|
#using <system.drawing.dll> using namespace System; using namespace System::Drawing; protected: Void Form1::OnPaint(PaintEventArgs^ pe) { Graphics^ g = pe->Graphics; Image^ image = Image::FromFile("SampleImage.jpg"); Form::ClientSize = image->Size; g->DrawImage( image, 0, 0, image->Size.Width, image->Size.Height ); } |