📄 tabpage.vb
字号:
Imports System.ComponentModel
Imports System.Drawing.Drawing2D
<DesignTimeVisible(False), Description("Represents a single tab page in a MdiTabControl.TabControl.")> _
Public Class TabPage
Private m_BackHighColor As Color
Private m_BackHighColorDisabled As Color
Private m_BackLowColor As Color
Private m_BackLowColorDisabled As Color
Private m_BorderColor As Color
Private m_BorderColorDisabled As Color
Private m_ForeColorDisabled As Color
Private m_Selected As Boolean = False
Private m_Hot As Boolean = False
Private m_MaximumWidth As Integer
Private m_MinimumWidth As Integer
Private m_PadLeft As Integer
Private m_PadRight As Integer
Private m_CloseButtonVisible As Boolean
Private m_CloseButton As Image
Private m_CloseButtonImageHot As Image
Private m_CloseButtonImageDisabled As Image
Private m_CloseButtonBackHighColor As Color
Private m_CloseButtonBackLowColor As Color
Private m_CloseButtonBorderColor As Color
Private m_CloseButtonForeColor As Color
Private m_CloseButtonBackHighColorDisabled As Color
Private m_CloseButtonBackLowColorDisabled As Color
Private m_CloseButtonBorderColorDisabled As Color
Private m_CloseButtonForeColorDisabled As Color
Private m_CloseButtonBackHighColorHot As Color
Private m_CloseButtonBackLowColorHot As Color
Private m_CloseButtonBorderColorHot As Color
Private m_CloseButtonForeColorHot As Color
Private m_HotTrack As Boolean
Private m_CloseButtonSize As Size
Private m_FontBoldOnSelect As Boolean
Private m_IconSize As Size
Private m_SmoothingMode As SmoothingMode
Private m_Alignment As TabControl.TabAlignment
Private m_GlassGradient As Boolean
Private m_BorderEnhanced As Boolean
Private m_RenderMode As ToolStripRenderMode
Private m_BorderEnhanceWeight As TabControl.Weight
Friend WithEvents m_Form As Form
Friend TabVisible As Boolean
Friend TabLeft As Integer
Friend MenuItem As New ToolStripMenuItem
Private MouseOverCloseButton As Boolean = False
<Description("Occurs when the user clicks the Tab Control.")> _
Public Shadows Event Click(ByVal sender As Object, ByVal e As EventArgs)
Friend Event Close(ByVal sender As Object, ByVal e As EventArgs)
Friend Event GetTabRegion(ByVal sender As Object, ByVal e As TabControl.GetTabRegionEventArgs)
Friend Event TabPaintBackground(ByVal sender As Object, ByVal e As TabControl.TabPaintEventArgs)
Friend Event TabPaintBorder(ByVal sender As Object, ByVal e As TabControl.TabPaintEventArgs)
Friend Event Draging(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
Friend Event EnterForm As EventHandler
Friend Event LeaveForm As EventHandler
Sub New(ByVal Form As System.Windows.Forms.Form)
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.SuspendLayout()
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.UserPaint, True)
Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
MyBase.BackColor = Color.Transparent
Me.Visible = False
Me.Size = New System.Drawing.Size(1, 1)
Form.TopLevel = False
Form.MdiParent = Nothing
Form.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Form.Dock = DockStyle.Fill
Me.m_Form = Form
MenuItem.Text = Form.Text
MenuItem.Image = Form.Icon.ToBitmap
MenuItem.Tag = Me
Me.ResumeLayout(False)
End Sub
<Description("Gets the form associated with the tab page")> _
Public ReadOnly Property Form() As Object
Get
Return m_Form
End Get
End Property
<Description("Gets or sets the System.Drawing.Color structure that represents the starting color of the Background linear gradient for the tab.")> _
Public Property BackHighColor() As Color
Get
Return m_BackHighColor
End Get
Set(ByVal value As Color)
m_BackHighColor = value
Invalidate()
End Set
End Property
<Description("Gets or sets the System.Drawing.Color structure that represents the ending color of the Background linear gradient for the tab.")> _
Public Property BackLowColor() As Color
Get
Return m_BackLowColor
End Get
Set(ByVal value As Color)
m_BackLowColor = value
Invalidate()
End Set
End Property
<Description("Gets or sets the System.Drawing.Color structure that represents the border color.")> _
Friend Property BorderColor() As Color
Get
Return m_BorderColor
End Get
Set(ByVal value As Color)
m_BorderColor = value
Invalidate()
End Set
End Property
<Description("Gets or sets the System.Drawing.Color structure that represents the starting color of the Background linear gradient for a non selected tab.")> _
Public Property BackHighColorDisabled() As Color
Get
Return m_BackHighColorDisabled
End Get
Set(ByVal value As Color)
m_BackHighColorDisabled = value
Invalidate()
End Set
End Property
<Description("Gets or sets the System.Drawing.Color structure that represents the ending color of the Background linear gradient for a non selected tab.")> _
Public Property BackLowColorDisabled() As Color
Get
Return m_BackLowColorDisabled
End Get
Set(ByVal value As Color)
m_BackLowColorDisabled = value
Invalidate()
End Set
End Property
<Description("Gets or sets the System.Drawing.Color structure that represents the border color of the tab when not selected.")> _
Public Property BorderColorDisabled() As Color
Get
Return m_BorderColorDisabled
End Get
Set(ByVal value As Color)
m_BorderColorDisabled = value
Invalidate()
End Set
End Property
<Description("Gets or sets the System.Drawing.Color structure that represents the fore color of the tab when not selected.")> _
Public Property ForeColorDisabled() As Color
Get
Return m_ForeColorDisabled
End Get
Set(ByVal value As Color)
m_ForeColorDisabled = value
Invalidate()
End Set
End Property
Friend Property IsSelected() As Boolean
Get
Return m_Selected
End Get
Set(ByVal Value As Boolean)
If m_Selected <> Value Then
m_Selected = Value
If m_Selected Then
m_Hot = False
End If
Invalidate()
End If
End Set
End Property
<Description("Returns whether the tab is selected or not.")> _
Public ReadOnly Property Selected() As Boolean
Get
Return IsSelected
End Get
End Property
Friend Property MaximumWidth() As Integer
Get
Return m_MaximumWidth
End Get
Set(ByVal value As Integer)
m_MaximumWidth = value
CalculateWidth()
Invalidate()
End Set
End Property
Friend Property MinimumWidth() As Integer
Get
Return m_MinimumWidth
End Get
Set(ByVal value As Integer)
m_MinimumWidth = value
CalculateWidth()
Invalidate()
End Set
End Property
Friend Property PadLeft() As Integer
Get
Return m_PadLeft
End Get
Set(ByVal value As Integer)
m_PadLeft = value
CalculateWidth()
Invalidate()
End Set
End Property
Friend Property PadRight() As Integer
Get
Return m_PadRight
End Get
Set(ByVal value As Integer)
m_PadRight = value
CalculateWidth()
Invalidate()
End Set
End Property
<Description("Gets or sets whether the tab close button is visble or not.")> _
Public Property CloseButtonVisible() As Boolean
Get
Return m_CloseButtonVisible
End Get
Set(ByVal value As Boolean)
If m_CloseButtonVisible <> value Then
m_CloseButtonVisible = value
CalculateWidth()
Invalidate()
End If
End Set
End Property
Public Property CloseButtonImage() As Image
Get
Return m_CloseButton
End Get
Set(ByVal value As Image)
m_CloseButton = value
Invalidate()
End Set
End Property
Public Property CloseButtonImageHot() As Image
Get
Return m_CloseButtonImageHot
End Get
Set(ByVal value As Image)
m_CloseButtonImageHot = value
Invalidate()
End Set
End Property
Public Property CloseButtonImageDisabled() As Image
Get
Return m_CloseButtonImageDisabled
End Get
Set(ByVal value As Image)
m_CloseButtonImageDisabled = value
Invalidate()
End Set
End Property
Public Property CloseButtonBackHighColor() As System.Drawing.Color
Get
Return m_CloseButtonBackHighColor
End Get
Set(ByVal Value As Color)
m_CloseButtonBackHighColor = Value
End Set
End Property
Public Property CloseButtonBackLowColor() As System.Drawing.Color
Get
Return m_CloseButtonBackLowColor
End Get
Set(ByVal Value As Color)
m_CloseButtonBackLowColor = Value
End Set
End Property
Public Property CloseButtonBorderColor() As System.Drawing.Color
Get
Return m_CloseButtonBorderColor
End Get
Set(ByVal Value As Color)
m_CloseButtonBorderColor = Value
End Set
End Property
Public Property CloseButtonForeColor() As System.Drawing.Color
Get
Return m_CloseButtonForeColor
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -