Suppressing redraw of PictureBox after moving?

B

b747_440

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
 
B

b747_440

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
 
B

b747_440

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

WM_Message enumeration 1

Top