Skip to main content
GameDev.net gamedev.net
🔒 Locked

BitBlitting offscreen in Visual Basic?

Started by BMason Nov 13, 2000 at 4:30 PM 0 replies 600+ views
Original Post
BMason
BMason
Hi. I''m writing a simple program in Visual Basic for my Visual Basic class. The project is to have an MDI application with children. Each child has a picture box that you can draw a box, triangle, or circle to. The triangle and circle have to be inherited from a "general shape" class which I use as the rectangle class. The user has to be able to click on the picture box and use a bounding rectangle to define the size of their shapes. But I have run into a small snag. The bounding rectangle is redrawn every time I move the mouse. But the first thing it needs to do is to undraw the bounding box. When it does that it basically draws the bounding box the same color as the background color. But if there are already objects drawn there, then there end up being lines through my other shapes. This is really annoying me, and while part of the project also requires us to have a collection of the shapes (so a user can select a shape to be deleted) so I could just go through a for loop and have all the shapes redraw themselves whenever the mouse moves, it''s horribly inefficient. So I searched the web for information on how to copy the picture information and came across the BitBlt API in Windows. So I created a second Picture box and bit blitted to that. It worked great. But when I bitblit back I got unexpected results. It literally copied what was on my screen where the second picture box was, which in this case, was sitting below the start menu. So I got part of the start menu pasted back into my original picture box. This was not what I expected. So I need to figure out how to actually create a "picture object" that has no screen context whatsoever that I can bitblt to and from so that doesn''t happen. Or maybe someone can show a better way? I''ve already gone way beyond what the project requires me to do. When the teacher asked for a bounding box she just meant an invisible one, and she doesn''t even want filled objects. But I tend to add cool features to my programs because I get bored easily. :D I don''t even know why we''re supposed to be doing graphics functions in VB... we should be using VC++ instead. :D
It compiles! Ship it!
BMason
BMason
I got it to work! WOOT! :D
It compiles! Ship it!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.