English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi, anyone does know jhow can I mimic the MSN Live Messenger Form style. Specifically, I want to make applications without menubar but I want to be able to move them (like MSN when you "Hide the Menu Bar") I know that I can use Form Border = none But if by doing so I am unable to move the forma and I want to do that. I can add my own Minimize, Maximize and close Buttons but I can't move my form through the screen

I do not care much about the look and feel, what I really want to do is hde the menubar like in the image below and be able to move the window.

http://www.geocities.com/corea_80/Sample.png

2006-09-02 12:56:07 · 1 answers · asked by Héctor C 2 in Computers & Internet Programming & Design

1 answers

i guess you want to be done on windows platform.If yes go for dotnet(VB.NET)
Add some code to the form you want to move

Take two global variables(class level variables)
Private mouseOffset As Point
Private IsMouseDown As Boolean = False

Write the following event handlers for the form
1) Mouse Down Event
Handle the event if the left button of the mouse is clicked.And set the IsMouseDown value true

Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
Dim xOffSet As Integer
Dim yOffset As Integer
If e.Button = Windows.Forms.MouseButtons.Left Then
xOffSet = -e.X - SystemInformation.FrameBorderSize.Width
yOffset = -e.Y - SystemInformation.CaptionHeight - SystemInformation.FrameBorderSize.Height
mouseOffset = New Point(xOffSet, yOffset)
IsMouseDown = True
End If
End Sub

2) Mouse Move Event
If IsMouseDown variable value is true then set the new location for the form as that of Mouse

Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If IsMouseDown Then
Dim mousepos As Point = Control.MousePosition
mousepos.Offset(mouseOffset.X, mouseOffset.Y)
Location = mousepos
End If
End Sub
3) Mouse Up Event
Simply reset the IsMouseDown variable value to False If only Left Mouse button is UP.

Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
If e.Button = Windows.Forms.MouseButtons.Left Then
IsMouseDown = False
End If
End Sub

2006-09-05 03:07:56 · answer #1 · answered by bhiravi k 3 · 0 0

fedest.com, questions and answers