We help IT Professionals succeed at work.
Get Started

Paint/Redraw window while dragging

Last Modified: 2016-09-26
How do I get a window (form) to redraw as it's being dragged?  The form in question is set to always be on top.  This is a class that  inherits "Form".   Here the code that sets the style and exstyle for the window:

Protected Overrides ReadOnly Property CreateParams As System.Windows.Forms.CreateParams

            Const WS_SIZEBOX As Integer = &H40000
            Const WS_EX_TOOLWINDOW As Integer = &H80
            Const WS_EX_NOACTIVATE As Integer = &H8000000
            Const WS_EX_TOPMOST As Integer = &H8

            Dim params As CreateParams = MyBase.CreateParams
            params.Style = params.Style And (Not WS_SIZEBOX)
            params.ExStyle = params.ExStyle Or WS_EX_NOACTIVATE Or WS_EX_TOOLWINDOW Or WS_EX_TOPMOST
            Return params

        End Get
    End Property
Watch Question
Freelance programmer / Consultant
This problem has been solved!
Unlock 1 Answer and 16 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE