This is a migrated thread and some comments may be shown as answers.

Form not loading properly into Dock

3 Answers 88 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Denis Cilliers
Top achievements
Rank 1
Denis Cilliers asked on 24 Sep 2012, 02:49 PM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 24 Sep 2012, 03:00 PM
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 >>
0
Denis Cilliers
Top achievements
Rank 1
answered on 24 Sep 2012, 03:13 PM
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
0
Nikolay
Telerik team
answered on 24 Sep 2012, 04:00 PM
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 >>
Tags
Dock
Asked by
Denis Cilliers
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Denis Cilliers
Top achievements
Rank 1
Share this question
or