Results 1 to 4 of 4

Thread: Quick and easy(?) question

  1. #1
    Seth DK
    Guest

    Quick and easy(?) question

    Is it possible to change the BorderStyle of a form?

    I am making a sort of docking system so that I can either dock forms (using the SetParent API to bind to a picturebox) or show the form as floating.

    It looks stupid when the form does still have the titlebar when docking, and it also looks stupid when it's floating and there is no titlebar.

    I found out it is impossible to change the form's Borderstyle from 5 (toolbar) to 0 (none) at runtime. Is there any way I can do this anyway?

  2. #2

  3. #3
    Seth DK
    Guest

    Thanks...

    That seems very complicated. Isn't there another way? That's quite some code just for that purpose...

  4. #4
    Seth DK
    Guest
    Never mind that "complicated" statement. All I wanted to do was to toggle the titlebar and i simplified that milelong code you found to this and it works fine!

    Code:
    Public Function ToggleTitlebar(objForm As Form)
        
    Dim r As RECT
    
    SetWindowLong objForm.hWnd, GWL_STYLE, GetWindowLong(objForm.hWnd, GWL_STYLE) Xor (WS_THICKFRAME Or WS_CAPTION)
    GetWindowRect objForm.hWnd, r
    SetWindowPos objForm.hWnd, 0, r.Left, r.Top, r.Right - r.Left + 1, r.Bottom - r.Top, SWP_NOMOVE
        
    End Function
    Thanks again for the quick reply!

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