📄 sampleform.cs
字号:
{
if (tabbedGroups1.ActiveLeaf != null)
tabbedGroups1.ActiveLeaf.TabPages.Add(NewTabPage());
}
else
{
if (tabControl1.SelectedIndex == 1)
{
if (tabbedGroups2.ActiveLeaf != null)
tabbedGroups2.ActiveLeaf.TabPages.Add(NewTabPage());
}
else
{
if (tabbedGroups3.ActiveLeaf != null)
tabbedGroups3.ActiveLeaf.TabPages.Add(NewTabPage());
}
}
}
protected void OnRemovePage(object sender, EventArgs e)
{
Crownwood.Magic.Controls.TabControl tc = null;
// Find the active tab control in the selected group
if (tabControl1.SelectedIndex == 0)
{
if (tabbedGroups1.ActiveLeaf != null)
tc = tabbedGroups1.ActiveLeaf.GroupControl as Crownwood.Magic.Controls.TabControl;
}
else
{
if (tabControl1.SelectedIndex == 1)
{
if (tabbedGroups2.ActiveLeaf != null)
tc = tabbedGroups2.ActiveLeaf.GroupControl as Crownwood.Magic.Controls.TabControl;
}
else
{
if (tabbedGroups3.ActiveLeaf != null)
tc = tabbedGroups3.ActiveLeaf.GroupControl as Crownwood.Magic.Controls.TabControl;
}
}
// Did we find a current tab control?
if (tc != null)
{
// Does it have a selected tab?
if (tc.SelectedTab != null)
{
// Remove the page
tc.TabPages.Remove(tc.SelectedTab);
}
}
}
protected void OnSaveG1(object sender, EventArgs e)
{
tabbedGroups1.SaveConfigToFile(@"Group1.xml");
}
protected void OnLoadG1(object sender, EventArgs e)
{
try
{
tabbedGroups1.LoadConfigFromFile(@"Group1.xml");
}
finally
{
}
}
protected void OnSaveG2(object sender, EventArgs e)
{
tabbedGroups2.SaveConfigToFile(@"Group2.xml");
}
protected void OnLoadG2(object sender, EventArgs e)
{
try
{
tabbedGroups2.LoadConfigFromFile(@"Group2.xml");
}
finally
{
}
}
protected void OnSaveG3(object sender, EventArgs e)
{
tabbedGroups3.SaveConfigToFile(@"Group3.xml");
}
protected void OnLoadG3(object sender, EventArgs e)
{
try
{
tabbedGroups3.LoadConfigFromFile(@"Group3.xml");
}
finally
{
}
}
protected void OnDisplayMode(MenuCommand tabsMode)
{
// Default all the commands to not being checked
foreach(MenuCommand mc in tabsMode.MenuCommands)
mc.Checked = false;
switch(tabbedGroups1.DisplayTabMode)
{
case TabbedGroups.DisplayTabModes.HideAll:
tabsMode.MenuCommands[0].Checked = true;
break;
case TabbedGroups.DisplayTabModes.ShowAll:
tabsMode.MenuCommands[1].Checked = true;
break;
case TabbedGroups.DisplayTabModes.ShowActiveLeaf:
tabsMode.MenuCommands[2].Checked = true;
break;
case TabbedGroups.DisplayTabModes.ShowMouseOver:
tabsMode.MenuCommands[3].Checked = true;
break;
case TabbedGroups.DisplayTabModes.ShowActiveAndMouseOver:
tabsMode.MenuCommands[4].Checked = true;
break;
}
}
protected void OnHideAll(object sender, EventArgs e)
{
tabbedGroups1.DisplayTabMode = TabbedGroups.DisplayTabModes.HideAll;
tabbedGroups2.DisplayTabMode = TabbedGroups.DisplayTabModes.HideAll;
tabbedGroups3.DisplayTabMode = TabbedGroups.DisplayTabModes.HideAll;
}
protected void OnShowAll(object sender, EventArgs e)
{
tabbedGroups1.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowAll;
tabbedGroups2.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowAll;
tabbedGroups3.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowAll;
}
protected void OnShowActiveLeaf(object sender, EventArgs e)
{
tabbedGroups1.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowActiveLeaf;
tabbedGroups2.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowActiveLeaf;
tabbedGroups3.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowActiveLeaf;
}
protected void OnShowMouseOver(object sender, EventArgs e)
{
tabbedGroups1.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowMouseOver;
tabbedGroups2.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowMouseOver;
tabbedGroups3.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowMouseOver;
}
protected void OnShowActiveAndMouseOver(object sender, EventArgs e)
{
tabbedGroups1.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowActiveAndMouseOver;
tabbedGroups2.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowActiveAndMouseOver;
tabbedGroups3.DisplayTabMode = TabbedGroups.DisplayTabModes.ShowActiveAndMouseOver;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(SampleForm));
this.menuControl1 = new Crownwood.Magic.Menus.MenuControl();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.tabControl1 = new Crownwood.Magic.Controls.TabControl();
this.mainTabs = new System.Windows.Forms.ImageList(this.components);
this.tabPage2 = new Crownwood.Magic.Controls.TabPage();
this.tabbedGroups2 = new Crownwood.Magic.Controls.TabbedGroups();
this.groupTabs = new System.Windows.Forms.ImageList(this.components);
this.tabPage1 = new Crownwood.Magic.Controls.TabPage();
this.tabbedGroups1 = new Crownwood.Magic.Controls.TabbedGroups();
this.tabPage3 = new Crownwood.Magic.Controls.TabPage();
this.tabbedGroups3 = new Crownwood.Magic.Controls.TabbedGroups();
this.tabPage2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tabbedGroups2)).BeginInit();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tabbedGroups1)).BeginInit();
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tabbedGroups3)).BeginInit();
this.SuspendLayout();
//
// menuControl1
//
this.menuControl1.AnimateStyle = Crownwood.Magic.Menus.Animation.System;
this.menuControl1.AnimateTime = 100;
this.menuControl1.Cursor = System.Windows.Forms.Cursors.Arrow;
this.menuControl1.Direction = Crownwood.Magic.Common.Direction.Horizontal;
this.menuControl1.Dock = System.Windows.Forms.DockStyle.Top;
this.menuControl1.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
this.menuControl1.HighlightTextColor = System.Drawing.SystemColors.MenuText;
this.menuControl1.Name = "menuControl1";
this.menuControl1.Size = new System.Drawing.Size(512, 25);
this.menuControl1.Style = Crownwood.Magic.Common.VisualStyle.IDE;
this.menuControl1.TabIndex = 0;
this.menuControl1.TabStop = false;
this.menuControl1.Text = "menuControl1";
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 455);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Size = new System.Drawing.Size(512, 22);
this.statusBar1.TabIndex = 1;
this.statusBar1.Text = "statusBar1";
//
// tabControl1
//
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.HideTabsMode = Crownwood.Magic.Controls.TabControl.HideTabsModes.ShowAlways;
this.tabControl1.ImageList = this.mainTabs;
this.tabControl1.Location = new System.Drawing.Point(0, 25);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.SelectedTab = this.tabPage1;
this.tabControl1.Size = new System.Drawing.Size(512, 430);
this.tabControl1.TabIndex = 2;
this.tabControl1.TabPages.AddRange(new Crownwood.Magic.Controls.TabPage[] {
this.tabPage1,
this.tabPage2,
this.tabPage3});
//
// mainTabs
//
this.mainTabs.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
this.mainTabs.ImageSize = new System.Drawing.Size(16, 16);
this.mainTabs.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("mainTabs.ImageStream")));
this.mainTabs.TransparentColor = System.Drawing.Color.Transparent;
//
// tabPage2
//
this.tabPage2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.tabbedGroups2});
this.tabPage2.Dock = System.Windows.Forms.DockStyle.Fill;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -