Results 1 to 3 of 3

Thread: A problem with Form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    hongkong
    Posts
    251
    Dear ALL,
    I have a menu in the main form and of coz many other forms (some are dialogs while some are toolwindows) corresponding to each of the functions.

    I found that when I minimize the main form, the dialog / toolwindow forms are still on the desktop. I hope to minimize them also. So I have tried setting them as the child form of the main one (MDIChild = true). But If I do so, the rearragning events like tileHorizontally will affect the positioning of the dialog form and the other child documents.

    So I back to set MDIChild to False and set the borderstyle = 4 (Fixed Toolwindow) and position ot on the right side of the screen.

    In the main form load sub, I type:

    frmTool1.Show

    it does, but at the back of the main window

    so I hope to ask how to correct this?

    What is the usual practice (i.e. the settings) VB programmers would use in dealing multiple forms?

    Thank you

    How can I

  2. #2
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    Dump this in your form load of the toolbar. It will put in on top and keep it there.
    Code:
    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    
    SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, &H1 Or &H2
    Now, to minimize with the other form inyour main form's form_resize event place something like this
    Code:
    If Me.WindowState = vbMinimized Then
         frmTool1.Visible = False
    Else
         frmTool1.Visible = True
    End If

  3. #3
    Guest
    Instead of using &H1 Or &H2 you can simply put 3.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width