WinForms tab control problem

I have a form that is displayed in two modes. Switching the mode completely changes the appearance of the form, just like you use a tab control and have a different control layout on each tab Same.

If I can hide the tab itself, the tab control will be perfect.

Of course, I can use two panels and show and hide programmatically Appropriate panel. I tried this, but my anchoring has been messed up (I think this is a Visual Studio designer bug.)

Ideally, I want to use the “wizard” control , It is unlabeled. When designing, draw the control of the first page, switch the “PageNumber” property to the second page, and then drag and drop the control to the second page.

I think TabControl has The function without tabs, for example, it can create a wizard-style interface very well.

What is the best way so that my design time appearance mimics the runtime?

Currently, I have two panels, one is directly on the other panel, I flipped the visible properties of each panel, and my automatic anchoring is being messed up by VS. I may have to ask for help It’s not difficult to write my own archive code, but I like it. When the design environment reacts to the appearance of the screen when it is running, the possibility is very close. It will only make life easier.

I There is also a Telerik Q3 WinForm control, in case there are alternatives in this control set…

Suggest?

This is possible. Add a new class to the project and paste the code shown below. Compile Drag and drop the new control from the top of the toolbox onto the form. It has tabs at design time, so you can easily switch between pages. But hide them at runtime, use the SelectedIndex or SelectedTab properties in the code to switch views .

using System;
using System.Windows.Forms;

class PageControl: TabControl {
protected override void WndProc(ref Message m) {
// Hide tabs by trapping the TCM_ADJUSTRECT message
if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1;
else base.WndProc(ref m);
}
}

I have a form displayed in two modes. The switching mode is completely changed The appearance of the form is like you use the tab control and have a different control layout on each tab.

If I can hide the tab itself, the tab control will be perfect Of.

Of course, I can use two panels and show and hide the appropriate panels programmatically. I tried this, but my anchoring keeps messing up (I think it’s a Visual Studio Designer bug.)

Ideally, I would like to use the “wizard” control, which is unlabeled. When designing, draw the control on the first page and switch the “PageNumber” property to the first Second page, and then drag and drop the control to the second page.

I think TabControl has the function of not having tabs, for example, it can create a wizard-style interface very well.

< p>What is the best way so that my design time appearance mimics running time?

Currently, I have two panels, one is directly on the other panel, I flipped the visible properties of each panel, and my automatic anchoring is being messed up by VS. I may have to ask for help It’s not difficult to write my own archive code, but I like it. When the design environment reacts to the appearance of the screen when it is running, the possibility is very close. It will only make life easier.

I There is also a Telerik Q3 WinForm control, in case there are alternatives in this control set…

Suggest?

This is possible. Add a new class to the project and paste the code shown below. Compile. Drag and drop the new control from the top of the toolbox onto the form On. It has tabs at design time, so you can easily switch between pages. But hide them at runtime, use the SelectedIndex or SelectedTab properties in the code to switch views.

< /p>

using System;
using System.Windows.Forms;

class PageControl: TabControl {
protected override void WndProc(ref Message m) {
// Hide tabs by trapping the TCM_ADJUSTRECT message
if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1;
else base.WndProc(ref m);
}
}

Leave a Comment

Your email address will not be published.