Form not loading properly into Dock

4 posts, 1 answers
  1. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 24 Sep 2012 Link to this post

    I have an issue with loading forms in the Dock

    When I use MDI they load poroperly. On being told to drop the MDI overhead the forms load off to the bottm right of the screen
    Please help what is wrong with the code. 

    MDI loader
    Shared Sub dockMDIForm(ByVal mydockableform As Form)
      
            'Check if form already in Dock
            Dim hw As HostWindow = frmMain.radDockMain.GetHostWindow(mydockableform)
      
            If Not hw Is Nothing Then
                'Just show the window
                frmMain.radDockMain.ActiveWindow = hw
            Else
      
                'Create a new instance of the Form & add to dock
                mydockableform.MdiParent = frmMain
                mydockableform.Show()
      
                'frmMain.radDockMain.DockControl(mydockableform, DockPosition.Fill, DockType.Document)
                hw = frmMain.radDockMain.GetHostWindow(mydockableform)
      
                frmMain.radDockMain.ActiveWindow = hw
      
            End If
      
        End Sub



    Document loader
    Shared Sub dockForm(ByVal myForm As Form)
      
            myForm.FormBorderStyle = FormBorderStyle.None
            myForm.TopLevel = False
            myForm.WindowState = FormWindowState.Maximized
      
            'Check if form already in Dock
            Dim hw As HostWindow = frmMain.radDockMain.GetHostWindow(myForm)
        
            If Not hw Is Nothing Then
                'Just show the window
                frmMain.radDockMain.ActiveWindow = hw
            Else
                 'Create a new document
                Dim docWindow As DocumentWindow = New DocumentWindow()
                docWindow.Controls.Add(myForm)
        
                'add to Dock
                With frmMain.radDockMain
                    .AddDocument(docWindow, DockPosition.Fill)
                    .ActiveWindow = docWindow
                End With
      
                docWindow.DockTabStrip.PerformLayout()
            End If
        End Sub
  2. Answer
    Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 24 Sep 2012 Link to this post

    Hi Denis,

    I answered the question in the support ticket that you have regarding the same topic. In case our community is interested in the answer, it is the fact that you have to Dock the form to Fill:

    Dim myForm As FrmPlain = New FrmPlain()
    myForm.Dock = DockStyle.Fill

    I hope this helps.

    Greetings,
    Nikolay
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 24 Sep 2012 Link to this post

    Hi Nikolay

    Sorry I cant read :( 
    I used the code from the ticket box and not the attached project, when I opened your project I found the fill in it.

    Opps my bad....

    Thanks for the help

    Denis
  5. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 24 Sep 2012 Link to this post

    Hi Denis,

    I am glad to hear that the misunderstanding is resolved. Let us if you have additional questions on the case.

    Regards,
    Nikolay
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Back to Top