?? sampletabcontrol.vb
字號:
Dim page As Crownwood.Magic.Controls.TabPage
' Create a new page with the appropriate control for display, title text and image
page = New Crownwood.Magic.Controls.TabPage(_strings(_count), controlToAdd, Nothing, _count)
' Make this page become selected when added
page.Selected = True
tabControl.TabPages.Add(page)
' Update the count for creating new pages
_count += 1
If (_count > 6) Then
_count = 0
End If
End Sub
Protected Sub OnRemovePage(ByVal sender As Object, ByVal e As EventArgs) Handles removePage.Click
If (tabControl.TabPages.Count > 0) Then
tabControl.TabPages.RemoveAt(0)
End If
End Sub
Protected Sub OnClearAll(ByVal sender As Object, ByVal e As EventArgs) Handles clearAll.Click
tabControl.TabPages.Clear()
End Sub
Protected Sub OnStyleIDE(ByVal sender As Object, ByVal e As EventArgs) Handles radioIDE.Click
tabControl.Style = VisualStyle.IDE
If Not _update Then
UpdateControls()
Else
_update = False
End If
End Sub
Protected Sub OnStylePlain(ByVal sender As Object, ByVal e As EventArgs) Handles radioPlain.Click
tabControl.Style = VisualStyle.Plain
If Not _update Then
UpdateControls()
Else
_update = False
End If
End Sub
Protected Sub OnAppearanceMultiBox(ByVal sender As Object, ByVal e As EventArgs) Handles radioMultiBox.Click
tabControl.Appearance = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiBox
If Not _update Then
UpdateControls()
Else
_update = False
End If
End Sub
Protected Sub OnAppearanceMultiForm(ByVal sender As Object, ByVal e As EventArgs) Handles radioMultiForm.Click
tabControl.Appearance = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiForm
If Not _update Then
UpdateControls()
Else
_update = False
End If
End Sub
Protected Sub OnAppearanceMultiDocument(ByVal sender As Object, ByVal e As EventArgs) Handles radioMultiDocument.Click
tabControl.Appearance = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiDocument
If Not _update Then
UpdateControls()
Else
_update = False
End If
End Sub
Protected Sub positionAtTop_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles positionAtTop.Click
tabControl.PositionTop = positionAtTop.Checked
UpdateControls()
End Sub
Protected Sub Highlight_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles hotTrack.Click
tabControl.HotTrack = hotTrack.Checked
UpdateControls()
End Sub
Protected Sub shrinkPages_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles shrinkPages.Click
tabControl.ShrinkPagesToFit = shrinkPages.Checked
UpdateControls()
End Sub
Protected Sub showClose_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles showClose.Click
tabControl.ShowClose = showClose.Checked
UpdateControls()
End Sub
Protected Sub showArrows_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles showArrows.Click
tabControl.ShowArrows = showArrows.Checked
UpdateControls()
End Sub
Protected Sub insetPlain_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles insetPlain.Click
tabControl.InsetPlain = insetPlain.Checked
UpdateControls()
End Sub
Protected Sub idePixelBorder_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles idePixelBorder.Click
tabControl.IDEPixelBorder = idePixelBorder.Checked
UpdateControls()
End Sub
Private Sub idePixelArea_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles idePixelArea.CheckedChanged
tabControl.IDEPixelArea = idePixelArea.Checked
UpdateControls()
End Sub
Protected Sub insetPagesOnly_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles insetPagesOnly.Click
tabControl.InsetBorderPagesOnly = insetPagesOnly.Checked
UpdateControls()
End Sub
Protected Sub selectedTextOnly_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles selectedTextOnly.Click
tabControl.SelectedTextOnly = selectedTextOnly.Checked
UpdateControls()
End Sub
Protected Sub numericUpDown1_ValueChanged(ByVal sender As Object, ByVal e As EventArgs) Handles numericUpDown1.Click
tabControl.ControlLeftOffset = Val(numericUpDown1.Value)
UpdateControls()
End Sub
Protected Sub numericUpDown3_ValueChanged(ByVal sender As Object, ByVal e As EventArgs) Handles numericUpDown3.Click
tabControl.ControlTopOffset = Val(numericUpDown3.Value)
UpdateControls()
End Sub
Protected Sub numericUpDown2_ValueChanged(ByVal sender As Object, ByVal e As EventArgs) Handles numericUpDown2.Click
tabControl.ControlRightOffset = Val(numericUpDown2.Value)
UpdateControls()
End Sub
Protected Sub numericUpDown4_ValueChanged(ByVal sender As Object, ByVal e As EventArgs) Handles numericUpDown4.Click
tabControl.ControlBottomOffset = Val(numericUpDown4.Value)
UpdateControls()
End Sub
Private Sub tabShowAlways_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabShowAlways.CheckedChanged
tabControl.HideTabsMode = Crownwood.Magic.Controls.TabControl.HideTabsModes.ShowAlways
If Not _update Then
UpdateControls()
Else
_update = False
End If
End Sub
Private Sub tabHideAlways_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabHideAlways.CheckedChanged
tabControl.HideTabsMode = Crownwood.Magic.Controls.TabControl.HideTabsModes.HideAlways
If Not _update Then
UpdateControls()
Else
_update = False
End If
End Sub
Private Sub tabHideUsingLogic_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabHideUsingLogic.CheckedChanged
tabControl.HideTabsMode = Crownwood.Magic.Controls.TabControl.HideTabsModes.HideUsingLogic
If Not _update Then
UpdateControls()
Else
_update = False
End If
End Sub
Private Sub tabHideWithoutMouse_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabHideWithoutMouse.CheckedChanged
tabControl.HideTabsMode = Crownwood.Magic.Controls.TabControl.HideTabsModes.HideWithoutMouse
If Not _update Then
UpdateControls()
Else
_update = False
End If
End Sub
Protected Sub hoverSelect_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hoverSelect.Click
tabControl.HoverSelect = hoverSelect.Checked
UpdateControls()
End Sub
Private Sub multiline_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles multiline.CheckedChanged
tabControl.Multiline = multiline.Checked
UpdateControls()
End Sub
Private Sub multilineFullWidth_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles multilineFullWidth.CheckedChanged
tabControl.MultilineFullWidth = multilineFullWidth.Checked
UpdateControls()
End Sub
Protected Sub normal_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles normal.Click
' Give the tabControl a blue appearance
tabControl.BackColor = _startBackColor
tabControl.ForeColor = _startForeColor
tabControl.ButtonActiveColor = _startButtonActive
tabControl.ButtonInactiveColor = _startButtonInactive
tabControl.TextInactiveColor = _startTextInactiveColor
tabControl.HotTextColor = _startHotTextColor
DefinePageColors(_startBackColor, _startForeColor)
End Sub
Protected Sub blue_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles blue.Click
' Give the tabControl a blue appearance
tabControl.BackColor = Color.DarkBlue
tabControl.ForeColor = Color.White
tabControl.ButtonActiveColor = Color.White
tabControl.ButtonInactiveColor = Color.LightBlue
tabControl.TextInactiveColor = Color.Yellow
tabControl.HotTextColor = Color.Orange
DefinePageColors(Color.DarkBlue, Color.White)
End Sub
Protected Sub red_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles red.Click
' Give the tabControl a red appearance
tabControl.BackColor = Color.DarkRed
tabControl.ForeColor = Color.White
tabControl.ButtonActiveColor = Color.White
tabControl.ButtonInactiveColor = Color.Red
tabControl.TextInactiveColor = Color.White
tabControl.HotTextColor = Color.Cyan
DefinePageColors(Color.DarkRed, Color.White)
End Sub
Protected Sub DefinePageColors(ByVal newBack As Color, ByVal newFore As Color)
Dim page As Crownwood.Magic.Controls.TabPage
For Each page In tabControl.TabPages
If Not (page.Control Is Nothing) Then
page.Control.ForeColor = newFore
page.Control.BackColor = newBack
End If
Next
End Sub
End Class
Public Class DummyForm
Inherits Form
Private _dummy1 As New Button()
Private _dummy2 As New Button()
Private _dummyBox As New GroupBox()
Private _dummy3 As New RadioButton()
Private _dummy4 As New RadioButton()
Public Sub New()
_dummy1.Text = "Dummy 1"
_dummy1.Size = New Size(90, 25)
_dummy1.Location = New Point(10, 10)
_dummy2.Text = "Dummy 2"
_dummy2.Size = New Size(90, 25)
_dummy2.Location = New Point(110, 10)
_dummyBox.Text = "Form GroupBox"
_dummyBox.Size = New Size(190, 67)
_dummyBox.Location = New Point(10, 45)
_dummy3.Text = "Dummy 3"
_dummy3.Size = New Size(100, 22)
_dummy3.Location = New Point(10, 20)
_dummy4.Text = "Dummy 4"
_dummy4.Size = New Size(100, 22)
_dummy4.Location = New Point(10, 42)
_dummy4.Checked = True
_dummyBox.Controls.AddRange(New Control() {_dummy3, _dummy4})
Controls.AddRange(New Control() {_dummy1, _dummy2, _dummyBox})
' Define then control to be selected when first is activated for first time
Me.ActiveControl = _dummy4
End Sub
End Class
Public Class DummyPanel
Inherits Panel
Private _dummyBox As New GroupBox()
Private _dummy3 As New RadioButton()
Private _dummy4 As New RadioButton()
Public Sub New()
_dummyBox.Text = "Panel GroupBox"
_dummyBox.Size = New Size(190, 67)
_dummyBox.Location = New Point(10, 10)
_dummy3.Text = "RadioButton 3"
_dummy3.Size = New Size(100, 22)
_dummy3.Location = New Point(10, 20)
_dummy4.Text = "RadioButton 4"
_dummy4.Size = New Size(100, 22)
_dummy4.Location = New Point(10, 42)
_dummy4.Checked = True
_dummyBox.Controls.AddRange(New Control() {_dummy3, _dummy4})
Controls.AddRange(New Control() {_dummyBox})
End Sub
End Class
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -