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

Floating Form in radDock

4 Answers 240 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Badrane
Top achievements
Rank 1
Badrane asked on 06 Jun 2016, 07:00 AM

radDock Position = Fill, Top, Bottom......

I want the loaded form will be in floatting mode without drag and drop it in the radDok.

I tried with the below code but I am not satisfied:

<p>var frmBrand = new FormBrand();<br>frmBrand.Text = @"Brand::  ";v<br>HostWindow host = radDock1.DockControl(frmBrand, new DockPosition()); </p><p>//HostWindow host = radDock1.DockControl(frmBrand, DockPosition.Left)<br>host.DockState = DockState.Docked;<br>radDock1.AutoDetectMdiChildren = true;<br><br>frmBrand.Show();</p>

4 Answers, 1 is accepted

Sort by
0
Badrane
Top achievements
Rank 1
answered on 06 Jun 2016, 07:04 AM

1.var frmBrand = new FormBrand();
2.frmBrand.Text = @"Brand:: ";
3.HostWindow host = radDock1.DockControl(frmBrand, new DockPosition());
4.//HostWindow host = radDock1.DockControl(frmBrand, DockPosition.Left)
5.host.DockState = DockState.Docked;
6.radDock1.AutoDetectMdiChildren = true;
7.frmBrand.Show();

0
Dimitar
Telerik team
answered on 07 Jun 2016, 11:58 AM
Hi Badrane,

Thank you for writing.

You need to set the DockState to Floating. For example:
private void radButton1_Click(object sender, EventArgs e)
{
    Form form = new Form();
    form.BackColor = Color.Pink;
    form.Text = "My Form";
    var host = this.radDock1.DockControl(form, DockPosition.Left);
    form.Show();
 
    host.DockState = DockState.Floating;
 
}

The following article shows how you can work with the MDI mode: Automatic MDI Form Handling.

I hope this will be useful. 

Regards,
Dimitar
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Badrane
Top achievements
Rank 1
answered on 09 Jun 2016, 03:05 AM

First, Thank you.

1- The DockPosition was in the left and after that was detached and moved to the middle?

I want to see the form Floating without any DockPosition value.

2- The form have lost its origin size (high, width)? why, I tried to restore it in the run time without success

frmBrand.Size = new Size(495, 287);

0
Dimitar
Telerik team
answered on 09 Jun 2016, 11:35 AM
Hi Badrane,

There is no way to directly add floating window without docking it first. To overcome this limitation you can show a separate form and then dock it when necessary.

Another approach would be to change the dock state of a DockWindow which will work faster and the change would not be so obvious:
DocumentWindow window = new DocumentWindow();
 
window.BackColor = Color.Pink;
window.Text = "My Form";
 
var host = this.radDock1.DockControl(window, DockPosition.Left);
host.DockState = DockState.Floating;

In addition, you can use the FloatingWindowCreated to change the size:
private void RadDock1_FloatingWindowCreated(object sender, FloatingWindowEventArgs e)
{
    e.Window.MinimumSize = new Size(800, 800);
}

I hope this will be useful. 

Regards,
Dimitar
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
Dock
Asked by
Badrane
Top achievements
Rank 1
Answers by
Badrane
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or