Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Graphics() Class and DrawImage

Status
Not open for further replies.

T0AD

Programmer
Jun 4, 2003
73
GB
Hello there.

I've just switched from VB6 to VB .Net and I'm having a bit of trouble with the following:

I have an image, which I load using:
Code:
Dim myBitmap As New Bitmap("C:\myImage.BMP")
Now this image is about 640 pixels high and 64 pixels wide, and I want to draw part of this image (64x64) to a PictureBox. Starting from the top 64x64, looping through the Y axis until the bottom 64x64 pixels are drawn, to create a kind of animation effect.

I create an instance of the Graphics() Class and use the DrawImage overload function, but I'm not sure which one to use - there's 30 and most (if not all) seem to fit the entire image into the 64x64 part that I want to draw!

Does anyone know the best way to do what I want? In VB6 I would use Bitblt, - is there a better .Net way (preferably just as fast!) Or, if I want to use BitBlt in .Net, how do I? When I call the API I keep getting an error telling me that the .Image can't be converted to a Long (or an Integer).

Any help would be much appreciated.

Pete
 
Toad,
This may be useless to you, I do not know much about the vb classes but I have come across some amazing programs that let you change pixels, formats and other crazy stuff in the image department. If this is not what you are looking for, please disregard this follow up as a blonde' moment. If you think this may be useful, we can chat further.[angel]
 
Hi SweetJustice,

Not sure if it'll help with the above, but it might help me with some other stuff I'm trying to do... what're these programs you're talking about? Are they open source .Net programs?

Many thanks for your help :)

Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top