AddPage() public méthode

Adds a new page/tab.
public AddPage ( String label, Control page = null ) : TabButton
label String Tab label.
page Control Page contents.
Résultat TabButton
Exemple #1
0
        public override bool DragAndDrop_HandleDrop(Package p, int x, int y)
        {
            Vector2i LocalPos = CanvasPosToLocal(new Vector2i(x, y));

            TabButton  button     = DragAndDrop.SourceControl as TabButton;
            TabControl tabControl = Parent as TabControl;

            if (tabControl != null && button != null)
            {
                if (button.TabControl != tabControl)
                {
                    // We've moved tab controls!
                    tabControl.AddPage(button);
                }
            }

            Control droppedOn = GetControlAt(LocalPos.X, LocalPos.Y);

            if (droppedOn != null && droppedOn != this)
            {
                Vector2i dropPos = droppedOn.CanvasPosToLocal(new Vector2i(x, y));
                DragAndDrop.SourceControl.BringNextToControl(droppedOn, dropPos.X > droppedOn.Width / 2);
            }
            else
            {
                DragAndDrop.SourceControl.BringToFront();
            }
            return(true);
        }
Exemple #2
0
        public void TestTabControl()
        {
            var control = new TabControl(canvas);
            control.AddPage("pg1");
            control.AddPage("pg2");
            control.AddPage("pg3");
            control.AddPage("pg4");

            GUI.Test(control, "TabControl1");
        }