Hi Suresh,
There are two methods to zoom an image.
1. Set the background image of a panel and set the image layout. For example, we can drag and drop a panel onto the form. Set its BackgroundImage property to the image and set its BackgroundImageLayout property to Stretch.
2. Draw the image with a source rectangle and a destination rectangle as parameters. This is a code snippet:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
//Get image.
Image img = Properties.Resources.untitled;
//Zoom factor.
float zoomFactor = 4.0f;
//The rect of the image which would be draw.
Rectangle imgRect = new Rectangle();
imgRect.Location = Point.Empty;
imgRect.Size = img.Size;
//The rect of the form where we would draw the image.
Rectangle drawRect = new Rectangle();
//This is the location where you want to draw the image.
drawRect.Location = new Point(5,5);
//Change the size according to the zoom factor.
drawRect.Size = new Size((int)(img.Size.Width * zoomFactor), (int)(img.Size.Height * zoomFactor));
//Draw the image.
e.Graphics.DrawImage(img, drawRect, imgRect, GraphicsUnit.Pixel);
}
You can get more about DrawImage method from:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.drawimage.aspx
Regards,
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.