Form Movement

Learner

Member
Joined
Jul 4, 2005
Messages
5
Programming Experience
Beginner
Hi all,

I am working on Desktop application using VB.NET.

I need to prevent user for moving child form with mouse in parent window.

Is there any way to prevent form movement if the form is child form and not maximized.

Thanks

Asif
 
Prevent DoubleClick Event on Form

Hi all,

Thanks for your reply and it works.

Now there is another isssue that I also wants to prevent users for double click on it ( double clicking makes the form re-sizable as it is called by using Show() method not ShowDialog()).

Can it is also prevent by cancelling double click action on form ?

Thanks a lot

Asif
 
VB.NET:
[SIZE=2][COLOR=#0000ff]Const[/COLOR][/SIZE][SIZE=2] WM_NCLBUTTONDBLCLK [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Int32 = &HA3
[/SIZE]
Perhaps you find others too if you look in the Platform SDK, User Interface Services, Windows User Interface, look into the different sections for Notifications in the references.
 
I would use some tricks here for the purpose
VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] myPoints [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Point = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Point(50, 50)[/SIZE]
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Private [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Form2_Move([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=2].Move
[/SIZE][SIZE=2][COLOR=#0000ff]  Me[/COLOR][/SIZE][SIZE=2].Location = myPoints
[/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Private [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Form2_Activated([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=2].Activated
    myPoints = [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Location
[/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]

and for the prevent double click i would set up the property MaximizeBox to false ... then it's useless if user double click the title area (form will not be maximized)

Take a look at the project below
Regards ;)
 

Attachments

  • LocationAndResize.zip
    28.7 KB · Views: 21

Latest posts

Back
Top