|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Suppressing redraw of PictureBox after moving?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 Hi,
Take a look at suspendlayout and resumelayout http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclasssuspendlayouttopic.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclassresumelayouttopic.asp Ken ----------------- <b747_***@yahoo.com> wrote in message Show quoteHide quote news:1153938125.847914.296670@m73g2000cwd.googlegroups.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 > 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: Show quoteHide quote > Hi, > > Take a look at suspendlayout and resumelayout > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclasssuspendlayouttopic.asp > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclassresumelayouttopic.asp > > Ken 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
VB Code question
At least one object must implement IComparable How to create multiple threads? What is an assembly? Compiling VB (.NET) files located in different directories Parsing Files with Regular Expressions Anyone can help me?£¬How to Convert C# to VB.NET, about Flood Fill Can WinCE & Pocket PC support the "AsyncCallback"? DataGridTableStyle How to launch program from CD after vb deployment installed |
|||||||||||||||||||||||