I will take a try at this allthough I have never done it before.
First down load the following Sample :
Bitmap Copy
http://www.microsoft.com/downloads/details.aspx?FamilyID=0fbfde9c-4e76-45e9-b083-e25ccbed9dfd
http://download.microsoft.com/downl...5-99f9-33ac4346a21b/BitmapCopySampleSetup.exe
In Form1() add the following lines :
bmList[3] = MyBitmap.Copy(bmList[0], new Rectangle(25, 25, 50, 50));
bmList[4] = MyBitmap.Copy(bmList[0], new Rectangle(25, 25, 50, 50));
Change the definitions of bmList and nameList to this :
Bitmap[] bmList = new Bitmap[5];
String[] nameList = {"Source", "Clone", "Section","Zoom","Double Zoom"};
Replace the OnPaint() with this :
protected override void OnPaint(PaintEventArgs e)
{
int x = 10;
int y = 0;
int bmIndex = 0;
// Draw each bitmap and label starting at x,y
foreach (Bitmap bm in bmList)
{
// Make sure we are not drawing out of bounds
if (y + 20 + bm.Height > this.Bounds.Bottom)
{
y = 0;
x += 120;
}
// Draw the label
e.Graphics.DrawString(nameList[bmIndex++], font, blackBrush, x, y);
y += 20;
// Draw the bitmap
if ((bm == bmList[3]) || (bm == bmList[4]))
{
Rectangle destPosition;
if (bm == bmList[4])
destPosition = new Rectangle(x,y,bm.Width*2,bm.Height*2);
else
destPosition = new Rectangle(x,y,bm.Width,bm.Height);
int i_Zoom = 4;
int i_OneFourthOfWidth = (int)(bm.Width/i_Zoom);
int i_OneFourthOfHeight = (int)(bm.Height/i_Zoom);
int i_TwoFourthOfWidth = (int)(bm.Width/i_Zoom)*(int)(i_Zoom/2);
int i_TwoFourthOfHeight = (int)(bm.Height/i_Zoom)*(int)(i_Zoom/2);
Rectangle destPortionToShow = new
Rectangle(i_OneFourthOfWidth,i_OneFourthOfHeight,i_TwoFourthOfWidth,i_TwoFou
rthOfHeight);
e.Graphics.DrawImage(bm,destPosition,destPortionToShow,GraphicsUnit.Pixel);
}
else
e.Graphics.DrawImage(bm, x, y);
y += bm.Height + 3;
}
}
Run the program and look at the results.
Maybe this will help as a starter.
Mark Johnson, Berlin Germany
(e-mail address removed)