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] | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Alaric

Paragoomba
Level: 15

Posts: 11/72
EXP: 14932
For next: 1452

Since: 03-15-04

Since last post: 108 days
Last activity: 5 hours
Posted on 04-17-04 03:42 AM Link | Quote
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!
dan

Snap Dragon
Level: 43

Posts: 51/782
EXP: 534516
For next: 30530

Since: 03-15-04

Since last post: 20 hours
Last activity: 14 hours
Posted on 04-17-04 05:08 AM Link | Quote
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

Paragoomba
Level: 15

Posts: 12/72
EXP: 14932
For next: 1452

Since: 03-15-04

Since last post: 108 days
Last activity: 5 hours
Posted on 04-17-04 05:15 AM Link | Quote
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!
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 413/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-18-04 02:31 AM Link | Quote
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

Paragoomba
Level: 15

Posts: 15/72
EXP: 14932
For next: 1452

Since: 03-15-04

Since last post: 108 days
Last activity: 5 hours
Posted on 04-18-04 06:43 AM Link | Quote
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
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 431/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-19-04 03:42 AM Link | Quote
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.
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
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.017 seconds.