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); }
This Blog is a programing portal, with tutorials and references relating to development subjects, including C#,Silverlight,WCF, Asp.Net,HTML, XML, CSS, JavaScript,Sql, Windows Administration.
Thursday, March 8, 2012
Drawing image using e.Graphics into Paint event of control
Following code will paint the image on Picture box paint Event....
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment