SarahBenjamin Posted October 22, 2007 Report Share Posted October 22, 2007 How can I copy some part of bitmap1 to bitmap 2. In other words either copy or cut it from one graph to another. Thanks -Sarah Quote Link to comment Share on other sites More sharing options...
maximop Posted October 23, 2007 Report Share Posted October 23, 2007 Try using the DrawImageUnscaledAndClipped() method of the Graphics object. You will have to create a bitmap where the clipped region will be drawn to, and a rectangle that defines which region to clip. The sample code below can give you an idea of what you need to do: Image img = Image.FromFile("D:\\Beach.jpg"); Bitmap bmp = new Bitmap(img.Width, img.Height);Rectangle clipRect = new Rectangle(45, 175, 300, 150); Graphics g1 = Graphics.FromImage((Image)bmp); g1.DrawImageUnscaledAndClipped(img, clipRect); Quote Link to comment Share on other sites More sharing options...
SarahBenjamin Posted October 23, 2007 Author Report Share Posted October 23, 2007 Thanks for the reply, but I want to get a small piece of a 1500 px bitmap and then paste that on another bitmap. This statment will give me the whole bitmap Bitmap bmp = new Bitmap(img.Width, img.Height); How can I get a small portion of bit map. Thanks -Sarah Quote Link to comment Share on other sites More sharing options...
Frank Posted October 24, 2007 Report Share Posted October 24, 2007 Since this question is not related to Chart FX but is a general GDI+ question, you may have better luck at one of the Microsoft or general .NET forums. Quote Link to comment Share on other sites More sharing options...
SarahBenjamin Posted October 24, 2007 Author Report Share Posted October 24, 2007 Sure, thanks Frank... I figured it out.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.