WinForms Tab Security Question

I have a form that displays in two modes. Switch modes completely change the appearance of the form just as you would expect if you used a tab control and had a different layout of controls on each tab.

A tab control would be ideal if I could hide the tab.

Of course, I could use two panels and program and hide the corresponding panels. I tried this, but my pinning continues to mess up (I think this is a Visual Studio designer error.)

Ideally, I would like to use a “wizard” control that has no tabs, and during development, draw controls for the first page, switch the “PageNumber” property to the second page, and then remove the controls to the second page.

I thought TabControl had functionality to display without tabs, which would be nice to come up with a Wizard style interface, for example.

What is the best way to do this so that my design look mimics the runtime?

At the moment, I have two panels, one on top of the other, and I flip the visible property of each, and my auto snap is getting spoiled by VS. I may have to resort to writing my own archiving code, which is not difficult, but I like it when the env design reacts as closely as the ability to view the screen when it starts. It just makes life easier.

I also have Telerik Q3 WinForm controls, if there is an alternative in this kit ...

Suggestions?

+3
source share
4 answers

. , . . . , . , SelectedIndex SelectedTab .

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);
  }
}
+13

, SplitContainer SplitSeparator , ...

, , , , .

, ,

0

" " "", , , , / . "", " ", , . , " " , . , , . , , , IT ( ) , THEN /, , .

0
source

To imitate the Tab language, simple Remove. The problem is that you cannot easily return it, so I use it in those forms where I know that it will be opened for one specific reason and closed after that, without having to use the remote tab. If you open the form again using a different parameter, it will open with a different tab and delete unnecessary ones.

0
source

Source: https://habr.com/ru/post/1779533/


All Articles