Clipping an Image

sathya.cs

Active member
Joined
May 24, 2009
Messages
31
Programming Experience
Beginner
How to clip a image in WinForms ,for example clipping the background image with parameters size(x,y) and location(x,y)?
 
You would create a new Bitmap of the desired size, create a Graphics object from it using Graphics.FromImage, then call Graphics.DrawImage to draw the old Image onto the new one in the appropriate position.
 
Sir i am new to GDI kind of stuff...could you just give me some Glimpse of the code...Here wat i am trying is to clip a background image and set as the background image for a list view to make it look like its transperant...
 
How about you have a go, step by step? What's the first step?
You would create a new Bitmap of the desired size
Can you do that? If not, go to the documentation for the Bitmap class and see how to create one of a specific size.

bitmap class - MSDN Search

Once you've done that you can move onto the next step.

This is how you attack problems: break them into smaller problems and attack each one separately. When you've solved them all you have inherently solved the original problem. When someone gives you keywords, e.g. Bitmap and Graphics.FromImage, instead of just assuming that it's too hard, use those keywords to research for yourself. If you can't find what you need or you don't know how to use it when you find it, that's OK but the fact that that might happen is not a reason not to try.
 
Back
Top