19,464
社区成员
发帖
与我相关
我的任务
分享public:
void Clone_Example1( PaintEventArgs^ e )
{
// Create a Bitmap object from a file.
Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" );
// Clone a portion of the Bitmap object.
Rectangle cloneRect = Rectangle(0,0,100,100);
System::Drawing::Imaging::PixelFormat format = myBitmap->PixelFormat;
Bitmap^ cloneBitmap = myBitmap->Clone( cloneRect, format );
// Draw the cloned portion of the Bitmap object.
e->Graphics->DrawImage( cloneBitmap, 0, 0 );
}
public:
void Clone_Example2( PaintEventArgs^ e )
{
// Create a Bitmap object from a file.
Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" );
// Clone a portion of the Bitmap object.
RectangleF cloneRect = RectangleF(0,0,100,100);
System::Drawing::Imaging::PixelFormat format = myBitmap->PixelFormat;
Bitmap^ cloneBitmap = myBitmap->Clone( cloneRect, format );
// Draw the cloned portion of the Bitmap object.
e->Graphics->DrawImage( cloneBitmap, 0, 0 );
}
VOID Example_Clone(HDC hdc)
{
Graphics graphics(hdc);
// Create a Bitmap object from a JPEG file.
Bitmap bitmap(L"Climber.jpg");
// Clone a portion of the bitmap.
Bitmap* clone = bitmap.Clone(Rect(0, 0, 100, 100), PixelFormatDontCare);
// Draw the clone.
graphics.DrawImage(clone, 0, 0);
delete clone;
}