Ok, I created a powershell script and I am trying to make the main interface use a tabbed layout. I got all functionality i want working except i want to hide the tabs up top and use the buttons on the side to switch tabs. I already successfully have the buttons on the side selecting the different tabs, but i can't figure out how to hide the tabs up top? Anyone have any way how to do this???
Picture Says It Best:
References:
- http://msdn.microsoft.com/en-us/library/system.windows.forms.tabpage%28v=vs.90%29.aspx
- http://msdn.microsoft.com/en-us/library/system.windows.forms.tabpage.tabpagecontrolcollection%28v=vs.90%29.aspx
- http://msdn.microsoft.com/en-us/library/system.windows.forms.tabrenderer%28v=vs.90%29.aspx
- http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol%28v=vs.90%29.aspx
UPDATE
Found this link (WinForms Hiding TabControl Headers) but its for Vb.net. Been playing around with it for an hour or so but no luck so far >.>
My Code:
#Generated Form Function
function GenerateForm {
#region Import the Assemblies
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
#region Generated Form Objects
$MainMenu = New-Object System.Windows.Forms.Form
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#Panels
$Panel1 = New-Object System.Windows.Forms.Panel
$Panel2 = New-Object System.Windows.Forms.Panel
#Buttons
$HomeButton = New-Object System.Windows.Forms.Button
$ScriptSettingsButton = New-Object System.Windows.Forms.Button
$COTSButton = New-Object System.Windows.Forms.Button
$MicrosoftButton = New-Object System.Windows.Forms.Button
$ConfigureButton = New-Object System.Windows.Forms.Button
$MiscToolsButton = New-Object System.Windows.Forms.Button
$TabControl = New-Object System.Windows.Forms.TabControl
#Misc Items
$ProgressBar = New-Object System.Windows.Forms.ProgressBar
$StatusBar = New-Object System.Windows.Forms.StatusBar
#Tabs
$TabControl = New-object System.Windows.Forms.TabControl
$HomeTab = New-Object System.Windows.Forms.TabPage
$ScriptSettingsTab = New-Object System.Windows.Forms.TabPage
#----------------------------------------------
#Generated Event Script Blocks
#----------------------------------------------
#Provide Custom Code for events specified in PrimalForms.
#Unknown
$handler_MainMenu_Load =
$OnLoadForm_StateCorrection= { $MainMenu.WindowState = $InitialFormWindowState }
#Buttons
$HomeButton_OnClick = { $TabControl.SelectTab($HomeTab) }
$ScriptSettingsButton_OnClick = { $TabControl.SelectTab($ScriptSettingsTab) }
$COTSButton_OnClick = {}
$MicrosoftButton_OnClick = { }
$ConfigureButton_OnClick = {}
$MiscToolsButton_OnClick = {}
$Hometab.Enabled =
$statusBar1_PanelClick=
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 474
$System_Drawing_Size.Width = 665
$MainMenu.ClientSize = $System_Drawing_Size
$MainMenu.DataBindings.DefaultDataSourceUpdateMode = 0
$MainMenu.Name = "MainMenu"
$MainMenu.Text = "Patching Script"
$MainMenu.TopMost = $True
$MainMenu.add_Load($handler_form1_Load)
# == Home Button == #
$HomeButton.Name = "HomeButton"
$HomeButton.Text = "Home"
$HomeButton.TabIndex = 2
$HomeButton.UseVisualStyleBackColor = $True
$HomeButton.add_Click($HomeButton_OnClick)
$HomeButton.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 69
$HomeButton.Location = $System_Drawing_Point
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 35
$System_Drawing_Size.Width = 100
$HomeButton.Size = $System_Drawing_Size
$MainMenu.Controls.Add($HomeButton)
# == Script Settings Button == #
$ScriptSettingsButton.Name = "ScriptSettingsButton"
$ScriptSettingsButton.Text = "Script Settings"
$ScriptSettingsButton.TabIndex = 3
$ScriptSettingsButton.UseVisualStyleBackColor = $True
$ScriptSettingsButton.add_Click($ScriptSettingsButton_OnClick)
$ScriptSettingsButton.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 110
$ScriptSettingsButton.Location = $System_Drawing_Point
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 35
$System_Drawing_Size.Width = 100
$ScriptSettingsButton.Size = $System_Drawing_Size
$MainMenu.Controls.Add($ScriptSettingsButton)
# == COTS Button == #
$COTSButton.Name = "COTSButton"
$COTSButton.Text = "C.O.T.S."
$COTSButton.TabIndex = 4
$COTSButton.UseVisualStyleBackColor = $True
$COTSButton.add_Click($COTSButton_OnClick)
$COTSButton.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 151
$COTSButton.Location = $System_Drawing_Point
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 35
$System_Drawing_Size.Width = 100
$COTSButton.Size = $System_Drawing_Size
$MainMenu.Controls.Add($COTSButton)
# == Microsoft Button == #
$MicrosoftButton.Name = "MicrosoftButton"
$MicrosoftButton.Text = "Microsoft Patches"
$MicrosoftButton.TabIndex = 5
$MicrosoftButton.UseVisualStyleBackColor = $True
$MicrosoftButton.add_Click($MicrosoftButton_OnClick)
$MicrosoftButton.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 192
$MicrosoftButton.Location = $System_Drawing_Point
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 35
$System_Drawing_Size.Width = 100
$MicrosoftButton.Size = $System_Drawing_Size
$MainMenu.Controls.Add($MicrosoftButton)
# == Configure Button == #
$ConfigureButton.Name = "ConfigureButton"
$ConfigureButton.Text = "Configure Script"
$ConfigureButton.TabIndex = 6
$ConfigureButton.Location = $System_Drawing_Point
$ConfigureButton.UseVisualStyleBackColor = $True
$ConfigureButton.add_Click($ConfigureButton_OnClick)
$ConfigureButton.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 233
$ConfigureButton.Location = $System_Drawing_Point
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 35
$System_Drawing_Size.Width = 100
$ConfigureButton.Size = $System_Drawing_Size
$MainMenu.Controls.Add($ConfigureButton)
# == Misc Tools Button == #
$MiscToolsButton.Name = "MiscToolsButton"
$MiscToolsButton.Text = "Misc Tools"
$MiscToolsButton.TabIndex = 7
$MiscToolsButton.UseVisualStyleBackColor = $True
$MiscToolsButton.add_Click($MiscToolsButton_OnClick)
$MiscToolsButton.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 274
$MiscToolsButton.Location = $System_Drawing_Point
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 35
$System_Drawing_Size.Width = 100
$MiscToolsButton.Size = $System_Drawing_Size
$MainMenu.Controls.Add($MiscToolsButton)
# == Tab Control == #
$TabControl.Name = "TabControl"
$TabControl.TabIndex = 4
$TabControl.SelectedIndex = 0
$TabControl.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 118
$System_Drawing_Point.Y = 70
$TabControl.Location = $System_Drawing_Point
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 374
$System_Drawing_Size.Width = 535
$TabControl.Size = $System_Drawing_Size
$MainMenu.Controls.Add($TabControl)
# == Home Tab == #
$HomeTab.DataBindings.DefaultDataSourceUpdateMode = 0
$HomeTab.Name = "HomeTab"
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 4
$System_Drawing_Point.Y = 22
$HomeTab.Location = $System_Drawing_Point
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 205
$System_Drawing_Size.Width = 445
$HomeTab.Size = $System_Drawing_Size
$HomeTab.TabIndex = 2
$HomeTab.Text = "Tab2"
$HomeTab.UseVisualStyleBackColor = $True
$TabControl.Controls.Add($HomeTab)
# == Script Settings Tab == #
$ScriptSettingsTab.DataBindings.DefaultDataSourceUpdateMode = 0
$ScriptSettingsTab.Name = "ScriptSettingsTab"
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 4
$System_Drawing_Point.Y = 22
$ScriptSettingsTab.Location = $System_Drawing_Point
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 205
$System_Drawing_Size.Width = 445
$ScriptSettingsTab.Size = $System_Drawing_Size
$ScriptSettingsTab.TabIndex = 2
$ScriptSettingsTab.Text = "Tab2"
$ScriptSettingsTab.UseVisualStyleBackColor = $True
$TabControl.Controls.Add($ScriptSettingsTab)
# == Panel 1 == #
#$panel1.DataBindings.DefaultDataSourceUpdateMode = 0
#$System_Drawing_Point = New-Object System.Drawing.Point
#$System_Drawing_Point.X = 118
#$System_Drawing_Point.Y = 70
#$panel1.Location = $System_Drawing_Point
#$panel1.Name = "panel1"
#$System_Drawing_Size = New-Object System.Drawing.Size
#$System_Drawing_Size.Height = 374
#$System_Drawing_Size.Width = 535
#$panel1.Size = $System_Drawing_Size
#$panel1.TabIndex = 8
#$Panel1.BackColor = [System.Drawing.Color]::CornflowerBlue
#$MainMenu.Controls.Add($panel1)
# == Progress Bar == #
$progressBar.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 589
$System_Drawing_Point.Y = 458
$progressBar.Location = $System_Drawing_Point
$progressBar.Name = "progressBar"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 15
$System_Drawing_Size.Width = 75
$progressBar.Size = $System_Drawing_Size
$progressBar.TabIndex = 0
$MainMenu.Controls.Add($progressBar)
# == Status bar == #
$StatusBar.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 0
$System_Drawing_Point.Y = 456
$StatusBar.Location = $System_Drawing_Point
$StatusBar.Name = "StatusBar"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 18
$System_Drawing_Size.Width = 665
$StatusBar.Size = $System_Drawing_Size
$StatusBar.TabIndex = 1
$StatusBar.Text = "statusBar1"
$StatusBar.add_PanelClick($statusBar_PanelClick)
$MainMenu.Controls.Add($StatusBar)
# == Save and Open Form == #
$InitialFormWindowState = $MainMenu.WindowState
$MainMenu.add_Load($OnLoadForm_StateCorrection)
$MainMenu.ShowDialog()| Out-Null
} #End Function
#Call the Function
GenerateForm