Hey all, i am looking here to see if anyone would have a better way to acomplish this task below in less code.
Select Case mainMenu.theNumOpened
Case 1
Me.Text = "NBMsg1"
Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5)
Case 2
Me.Text = "NBMsg2"
Dim hwnd As IntPtr = FindWindow(vbNullString, "NBMsg1")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, Me.Height + 10, 0, 0, 1)
Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5)
Case 3
Me.Text = "NBMsg3"
Dim hwnd As IntPtr = FindWindow(vbNullString, "NBMsg2")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, Me.Height + 10, 0, 0, 1)
hwnd = FindWindow(vbNullString, "NBMsg1")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 2) + 15, 0, 0, 1)
Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5)
Case 4
Me.Text = "NBMsg4"
Dim hwnd As IntPtr = FindWindow(vbNullString, "NBMsg3")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, Me.Height + 10, 0, 0, 1)
hwnd = FindWindow(vbNullString, "NBMsg2")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 2) + 15, 0, 0, 1)
hwnd = FindWindow(vbNullString, "NBMsg1")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 3) + 20, 0, 0, 1)
Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5)
Case 5
Me.Text = "NBMsg5"
Dim hwnd As IntPtr = FindWindow(vbNullString, "NBMsg4")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, Me.Height + 10, 0, 0, 1)
hwnd = FindWindow(vbNullString, "NBMsg3")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 2) + 15, 0, 0, 1)
hwnd = FindWindow(vbNullString, "NBMsg2")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 3) + 20, 0, 0, 1)
hwnd = FindWindow(vbNullString, "NBMsg1")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 4) + 25, 0, 0, 1)
Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5)
Case 6
Me.Text = "NBMsg6"
Dim hwnd As IntPtr = FindWindow(vbNullString, "NBMsg5")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, Me.Height + 10, 0, 0, 1)
hwnd = FindWindow(vbNullString, "NBMsg4")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 2) + 15, 0, 0, 1)
hwnd = FindWindow(vbNullString, "NBMsg3")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 3) + 20, 0, 0, 1)
hwnd = FindWindow(vbNullString, "NBMsg2")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 4) + 25, 0, 0, 1)
hwnd = FindWindow(vbNullString, "NBMsg1")
SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 5) + 30, 0, 0, 1)
Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5)
Case Else
Me.Close()
Me.Dispose()
End Select
What it does is pass to it now many windows are currently already opened. So if one then of course it goes to case 1. If there are 2 opened then it moves the oldest down and puts the newest on top. etc etc. I have set it so that a max of 6 boxes can only be opened at one time.
If anyone knows how i could also "slide" them down (kinda like an effect of jQuery) then that would also be, well awesome to know! :o)
Any help/suggestions would be great! :o)
David