Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - BitBlt and AutoRedraw [VB]
  
User name:
Password:
Reply:
 

UserPost
HyperLamer
Posts: 431/8210
Originally posted by Alaric
Draw on a buffer in memory? I.e. Create a new DC, draw on it, copy the contents to the picturebox's DC?

Exactly. Look at CreateCompatibleBitmap(), CreateCompatibleDC() and SelectObject(). Just don't forget to delete the buffers when the program closes or you'll get a memory leak.
Alaric
Posts: 15/72
Draw on a buffer in memory? I.e. Create a new DC, draw on it, copy the contents to the picturebox's DC?
I did notice that before i put the redraw code in paint(), i'd switch focus quickly and click Re-Render, get nice divided copies of whatever was in the tile area's place, but oh well..
Thanks for the help, and i'll consider only redrawing when my form has focus, thanks.
HyperLamer
Posts: 413/8210
FYI, Paint() runs every time the area is redrawn, active or not. To avoid extreme lag, consider only doing it when your window has focus. Also I suggest using double-buffering (draw on a buffer in memory and BitBlt to the form), this will eliminate flicker, and if you just copy the buffer to the form instead of redrawing in Paint() it'll go a lot faster too.
Alaric
Posts: 12/72
You know what...
I can't believe that i missed that!
Of course, i rarely (if ever) use Paint Events, so that's why it slipped my mind...
*Alaric wears the dunce cap.
Oh well, thanks dan!
dan
Posts: 51/782
I think there should be a paint event for the picturebox. If you put your drawing code in it, everytime the control is redrawn by Windows, it should have the image in it.
Alaric
Posts: 11/72
To avoid asking on IRC, where flames are more quick to come than on a forum, I've decided to ask here:
How do i get an Image BitBlt'ed onto a picturebox's DC to remain, for a level editor for Mario (TI-85) to work correctly, or At least how do i get an event to fire every time the form is returned focus (to redraw the image) (Activate doesn't work, i've tried GetFocus, etc.)? AutoRedraw does not work (of course, it's being unset before and set after the drawing)..

Thanks In Advance!
Acmlm's Board - I2 Archive - Programming - BitBlt and AutoRedraw [VB]


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.010 seconds.