Archived

This topic is now archived and is closed to further replies.

win32 api

This topic is 6611 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

currently the map editor is only in the early stages of implementation. Basically what I want to do is bitblt a picture from the picture box to the top left corner on the form when the user clicks there.
In the form load proc I load the bmp of the tile into the picture box which is on a frame on the form. Whenever the user clicks on the form at the top left corner it should bitblt the picture from the pic box to (0,0) on the form but as I said before the picture shows up as a black square. The Procedure I am using with bitblt is SRCCopy. Should I be using that procedure?

Share this post


Link to post
Share on other sites
I don't work with Visual Basic anymore so I don't really know. But I would check all my return values and write them to a file, so you can see what might go wrong.

Also, I'm not quite sure, but you load a bitmap into the picturebox (on the run I supose). I don't knw how the structure in a VB project is build up. But with VC++ you need to have the bitmap in the same directory as your executable file is. When VC++ compiles and runs the program it looks for the file in the directory right under the directory where the exectuable is located. Maybe it's such a problem.

I would definitely chck whether the file IS loaded (through a return value).

Maybe smeone with knowledge about VB should answer this question....

------------------
Dance with me......

Share this post


Link to post
Share on other sites
I know it can be done as I have done it in the past. I cant remember which flags you should use on the blit though. My advice would be to us the API viewer to get the declares for all the different blit modes and try them out. Also it might be worth trying to blit to another picturebox instead of the form.

Just had a look at the last thing I wrote that did this and this is what I used

BitBlt picBackground.hdc, 0, 0, objfBitmap.Width, objfBitmap.Height, objfBitmap.hdc, 0, 0, SRCCOPY

(objfBitmap is an instance of vb class that some one here wrote that basicly just creates a GDI bitmap.)

so SRCcopy is probably ok.

Also I make quite heavy use of hte win32sdk.hlp help file.

Share this post


Link to post
Share on other sites
I am programming a map editor in vb and when I use the bitblt() function of the win api to blit the tiles from a pic box to the form it only blits a black square the size of the tile. I have all the required params right, so why is this happening?
RSVP
Any help is greatly appreciated.
Guru

Share this post


Link to post
Share on other sites