472,334 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

Suppressing redraw of PictureBox after moving?

Hello Newsgroup,
I try to resize and move a picturebox. However, after each operation
the picture box is being redrawn. This causes flickering. Is it
possible to suppress the first redraw and draw both operations at once
after they have been completed?
I have tried overriding OnPaint, OnBackgroundErase, etc. Double
Buffering, AllPaintingInWmPaint, etc. has been set to true.
No success so far.
Now I'm trying to catch Windows Messages like WM_WINDOWPOSCHANGING by
overriding WndProc.
I have figured out, these messages are being sent while resizing and
moving the picturebox:
WM_WINDOWPOSCHANGING
WM_NCPAINT
WM_ERASEBKGND
WM_WINDOWPOSCHANGED
WM_MOVE
WM_NCCALCSIZE
WM_SIZE
WM_GETTEXTLENGTH
WM_GETTEXT
Any idea, where to start?
Thanks a lot,
Bart

Jul 26 '06 #1
3 2241
Hi,

Take a look at suspendlayout and resumelayout

http://msdn.microsoft.com/library/de...ayouttopic.asp

http://msdn.microsoft.com/library/de...ayouttopic.asp

Ken
-----------------
<b7******@yahoo.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hello Newsgroup,
I try to resize and move a picturebox. However, after each operation
the picture box is being redrawn. This causes flickering. Is it
possible to suppress the first redraw and draw both operations at once
after they have been completed?
I have tried overriding OnPaint, OnBackgroundErase, etc. Double
Buffering, AllPaintingInWmPaint, etc. has been set to true.
No success so far.
Now I'm trying to catch Windows Messages like WM_WINDOWPOSCHANGING by
overriding WndProc.
I have figured out, these messages are being sent while resizing and
moving the picturebox:
WM_WINDOWPOSCHANGING
WM_NCPAINT
WM_ERASEBKGND
WM_WINDOWPOSCHANGED
WM_MOVE
WM_NCCALCSIZE
WM_SIZE
WM_GETTEXTLENGTH
WM_GETTEXT
Any idea, where to start?
Thanks a lot,
Bart

Jul 27 '06 #2
Hi Ken,
thanks a lot!
I tried once more suspend/resume layout. I tried to suspend the layout
of my form, my UserControl and the PictureBox on the UserControl.
Unfortunately, I can still see both actions: Redrawing after moving the
PictureBox and again after Resizing it.
Maybe I should explain shortly, which effect I'd like to achieve:
I'd like to be able to point with the mouse cursor on the picture and
move the scroll wheel. Than there should be a zooming effect around the
center of the zoom, which should be the mouse pointer. These effects
work fine now. However, I still have that flickering effect and I'm
desperate to get rid of it. One can clearly see, that this flickering
comes from the moving and resizing effect. I have tried to to use
DrawImage instead but encountered a lot of different problems. So I
decided to stick with the idea of moving and resizing the PictureBox on
my UserControl.
Thanks a lot for any hints.
Sincerely,
Bart

Ken Tucker [MVP] wrote:
Hi,

Take a look at suspendlayout and resumelayout

http://msdn.microsoft.com/library/de...ayouttopic.asp

http://msdn.microsoft.com/library/de...ayouttopic.asp

Ken
Jul 27 '06 #3
Hello Ken & the Newsgroups,
I tried suspend layout in a simple context.
Please have a look below.
Suspend Layout does not seem to have any effect.
When Button1 is clicked, the picture box moves and this movement is
being redrawn despite the fact that the layout has been suspended.
Resuming layout by clicking Button2 does not have any effect. I have
expected, that the PictureBox movement will be drawn after clicking
Button2.
Any ideas or help?
Thank you,
Bart
Needed: Form, PictureBox1, Button1, Button2.
Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Picturebox1.left = 20
PictureBox1.Top = 20
PictureBox1.BackColor = Color.White
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
PictureBox1.SuspendLayout()
Me.SuspendLayout()
PictureBox1.Left = 200
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
PictureBox1.ResumeLayout()
Me.ResumeLayout()
End Sub
End Class

Jul 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris | last post by:
Hi, I am trying to set the position of a picture inside a picturebox with the folowing code: pctOutput.Picture = LoadPicture(App.Path &...
1
by: Charles A. Lackman | last post by:
Hello, I am trying to rotate a picturebox control. I have done some experimenting with rotating the image inside the picturebox, but I am trying...
0
by: Paul L | last post by:
I've created a picturebox inside a panel control with autoscroll enabled. The picturebox is twice the size of the panel so scrollbars are always...
1
by: Crirus | last post by:
Hi! I have a seamless image drawn onto a PictureBox. I wrote a mouseMove handle that allow me to drag the image around in that pictureBox. I...
8
by: Yogiman | last post by:
Hi Can anybody tell me how would I attach scrollbars to a picturebox ? The example given in MSDN is pretty good.But I have a different problem. I...
10
by: Liz | last post by:
All: Can anyone tell me why my animated GIF does not show up as animated when put into a pictureBox?? Thanks. Liz
3
by: Tyson Ackland | last post by:
Can someone tell me how you go about handling events where your window might be obscured and then when you bring it to the foreground, you want...
1
by: The Confessor | last post by:
(ellipses in place of code sections which do not deviate from defaults) Private Sub Form_Main_Load(...) Handles MyBase.Load For A = 0 To 16 For...
6
by: bradyounie | last post by:
I'm writing a program that displays a user-supplied Bitmap and then writes text fields to it. These "text fields" are things that the user can move...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.