Pages

Subscribe:

Ads 468x60px

Thursday, March 8, 2012

how to Drawing image using e.Graphics into Control's Paint event

In this web Programming Tutorial we will learn that how we can Draw an image using e.Graphics into Paint event of control in asp.net using c#.
private void pictureBox2_Paint(object sender, PaintEventArgs e)
       {
           // Create image.
           Image newImage = pictureBox1.Image;
 
           // Create coordinates for upper-left corner of image.
           int x = 100;
           int y = 100;
 
           // Create rectangle for source image.
           Rectangle srcRect = new Rectangle(facex, facey, 150, 150);
           GraphicsUnit units = GraphicsUnit.Pixel;
 
           // Draw image to screen.
           if(newImage != null)
           e.Graphics.DrawImage(newImage, x, y, srcRect, units);
            
       }

No comments:

Post a Comment