|
-
Aug 17th, 2005, 08:55 PM
#1
Thread Starter
Lively Member
Prevent control from painting
Can I prevent a control form painting until I want it to? Here is my situation:
I have a control consisting of 3 picture boxes, pbx1, pbx2 and pbx3 all in a row next to each other.
When a button is clicked, the images slowly slide to the left in unison. When pbx1 reaches a certain point on the left, it jumps to the end of the line so that the new order is pbx2, pbx3 then pbx1. The pictureboxes continue to slide to the left until pbx3 has reached pbx2's origninal position.
At this point I relocate each picturebox to its original location, but I change their images to match what was onscreen prior to that relocation. The end result is that there is a very slight flicker in my rightmost picturebox as it is swapped with leftmost picturebox and has its image changed.
It's not a huge deal, but I'd like to be able to turn off painting for just a fraction of a second while I reposition the pictureboxes and change their images. Once that is done, I'd turn painting back on.
Can anyone show me how to do this? I'm completely useless when it comes to overriding and canceling things.
Thanks,
-
Aug 17th, 2005, 09:02 PM
#2
Fanatic Member
Re: Prevent control from painting
I don't have a direct answer but I would like to say that you'd be much better off if you would draw those pictures yourself either on your form or on an inherited control, without the use of multiple pictureboxes.
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Aug 17th, 2005, 09:52 PM
#3
Re: Prevent control from painting
You should call SuspendLayout on the form prior to your actions and then ResumeLayout when you're done. I'm not 100% sure but I believe that could solve your problem.
-
Aug 22nd, 2005, 03:22 PM
#4
Re: Prevent control from painting
Why doesnt he use lockwindowupdate on the picture box so it doesnt update until its already been moved
-
Aug 23rd, 2005, 03:18 AM
#5
-
Aug 23rd, 2005, 04:45 AM
#6
Re: Prevent control from painting
the suspend and resumelayout functions prevent the drawing of new controls so that a large number of control changes can be made without the lag of displaying it until the end, according to msdn
http://msdn.microsoft.com/library/de...ayouttopic.asp
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|