P
Peter
Hi
I've discovered a bizarre Windows Forms (VB.NET) behavior that is
resulting in a Form not being able to be moved. To reproduce this:
1) Create yourself a new Windows Application in Visual Studio 2005.
2) A project will be created with one Form (Form 1). Don't add any
code to the project.
3) Run the project and confirm that Form 1 is displayed and you can
drag the Form around your screen by clicking and dragging the Form's
title bar, ie; standard Windows application behaviour.
4) Now add the following code to Form 1:
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
Beep()
End Sub
5) Now run the project again.
You will find that
a) If you click the empty client area of the Form your PC will beep as
you would expect.
b) If you click Form 1's Title Bar or attempt to drag the Form the
application will lock and you can't access the Minimise, Maximise or
Close buttons on the Title Bar. The Form seems to lock for about 30 -
45 secs on my PC.
I discovered this issue in my main project and can't resolve it. It
seems that as soon as you declare a MouseDown event handler this
problem will arise.
Anyone got any ideas about why this happening?
Peter,
I've discovered a bizarre Windows Forms (VB.NET) behavior that is
resulting in a Form not being able to be moved. To reproduce this:
1) Create yourself a new Windows Application in Visual Studio 2005.
2) A project will be created with one Form (Form 1). Don't add any
code to the project.
3) Run the project and confirm that Form 1 is displayed and you can
drag the Form around your screen by clicking and dragging the Form's
title bar, ie; standard Windows application behaviour.
4) Now add the following code to Form 1:
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
Beep()
End Sub
5) Now run the project again.
You will find that
a) If you click the empty client area of the Form your PC will beep as
you would expect.
b) If you click Form 1's Title Bar or attempt to drag the Form the
application will lock and you can't access the Minimise, Maximise or
Close buttons on the Title Bar. The Form seems to lock for about 30 -
45 secs on my PC.
I discovered this issue in my main project and can't resolve it. It
seems that as soon as you declare a MouseDown event handler this
problem will arise.
Anyone got any ideas about why this happening?
Peter,