现在的位置: 首页 > 综合 > 正文

LzmTW.uSystem.uWindows.uForms + ToolPanel

2013年10月23日 ⁄ 综合 ⁄ 共 10915字 ⁄ 字号 评论关闭
 Author:水如烟  

Imports System.Windows.Forms
Imports System.ComponentModel
Imports System.ComponentModel.Design
Namespace LzmTW.uSystem.uWindows.uForms

    <System.Drawing.ToolboxBitmap("../../Resources/ToolPanel.ico")> _
    
Friend Class ToolPanel
        
Sub New()
            System.Windows.Forms.Application.EnableVisualStyles()

            ' This call is required by the Windows Form Designer.
            InitializeComponent()

            ' Add any initialization after the InitializeComponent() call.
            ToolPanelInitialize()
        
End Sub

        Private Sub ToolPanelInitialize()
            VisualUiFont.Instance.SetFont(
Me.ToolStripButtonClose)
        
End Sub

        <Category("外观"), Description("与控件关联的文本"), Browsable(True), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
    
Public Overrides Property Text() As String
            
Get
                
Return Me.ToolStripLabelText.Text
            
End Get
            
Set(ByVal value As String)
                
Me.ToolStripLabelText.Text = value
            
End Set
        
End Property

        <Category("外观"), Description("关闭按钮是否有效"), Browsable(True), DefaultValue(True), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
        
Public Property CloseButtonEnabled() As Boolean
            
Get
                
Return Me.ToolStripButtonClose.Enabled
            
End Get
            
Set(ByVal value As Boolean)
                
Me.ToolStripButtonClose.Enabled = value
            
End Set
        
End Property

        <Category("外观"), Description("关闭按钮是否可见"), Browsable(True), DefaultValue(True), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
        
Public Property CloseButtonVisible() As Boolean
            
Get
                
Return Me.ToolStripButtonClose.Visible
            
End Get
            
Set(ByVal value As Boolean)
                
Me.ToolStripButtonClose.Visible = value
            
End Set
        
End Property

        <Category("容器"), Description("中间面板"), Browsable(True), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
        
Public ReadOnly Property ContentPanel() As ToolStripContentPanel
            
Get
                
Return Me.MainToolStripContainer.ContentPanel
            
End Get
        
End Property

        <Category("容器"), Description("菜单项"), Browsable(True), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
        
Public ReadOnly Property MenuToolStrip() As ToolStrip
            
Get
                
Return Me.gMenuToolStrip
            
End Get
        
End Property

        Private Sub ToolPanel_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Leave
            
Me.MainToolStripContainer.TopToolStripPanel.BackColor = System.Drawing.SystemColors.InactiveCaption
            
Me.gTopToolStrip.BackColor = System.Drawing.SystemColors.InactiveCaption
            
Me.ToolStripLabelText.BackColor = System.Drawing.SystemColors.InactiveCaption
            
Me.ToolStripButtonClose.BackColor = System.Drawing.SystemColors.InactiveCaption
            
Me.ToolStripLabelText.ForeColor = System.Drawing.SystemColors.InactiveCaptionText
            
Me.ToolStripButtonClose.ForeColor = System.Drawing.SystemColors.InactiveCaptionText
        
End Sub

        Private Sub ToolPanel_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Enter
            
Me.MainToolStripContainer.TopToolStripPanel.BackColor = System.Drawing.SystemColors.ActiveCaption
            
Me.gTopToolStrip.BackColor = System.Drawing.SystemColors.ActiveCaption
            
Me.ToolStripLabelText.BackColor = System.Drawing.SystemColors.ActiveCaption
            
Me.ToolStripButtonClose.BackColor = System.Drawing.SystemColors.ActiveCaption
            
Me.ToolStripLabelText.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
            
Me.ToolStripButtonClose.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        
End Sub

        Private Sub ToolStripButtonClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButtonClose.Click
            
Dim mPanel As Control
            mPanel 
= Me.Parent

            Do While mPanel.Parent IsNot Nothing AndAlso Not (TypeOf mPanel.Parent Is Form)
                mPanel 
= mPanel.Parent
            
Loop

            If TypeOf mPanel Is Form Then
                mPanel 
= Me
            
End If

            mPanel.Parent.Controls.Remove(mPanel)
            mPanel.Dispose()

        End Sub
    
End Class

End Namespace

 

Namespace LzmTW.uSystem.uWindows.uForms
    
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    
Partial Class ToolPanel
        
Inherits System.Windows.Forms.UserControl

        'UserControl 重写 Dispose,以清理组件列表。
        <System.Diagnostics.DebuggerNonUserCode()> _
        
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            
If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            
End If
            
MyBase.Dispose(disposing)
        
End Sub

        'Windows 窗体设计器所必需的
        Private components As System.ComponentModel.IContainer

        '注意: 以下过程是 Windows 窗体设计器所必需的
        '可以使用 Windows 窗体设计器修改它。
        '不要使用代码编辑器修改它。
        <System.Diagnostics.DebuggerStepThrough()> _
        
Private Sub InitializeComponent()
            
Me.MainToolStripContainer = New System.Windows.Forms.ToolStripContainer
            
Me.gTopToolStrip = New System.Windows.Forms.ToolStrip
            
Me.ToolStripLabelText = New System.Windows.Forms.ToolStripLabel
            
Me.ToolStripButtonClose = New System.Windows.Forms.ToolStripButton
            
Me.gMenuToolStrip = New System.Windows.Forms.ToolStrip
            
Me.MainToolStripContainer.TopToolStripPanel.SuspendLayout()
            
Me.MainToolStripContainer.SuspendLayout()
            
Me.gTopToolStrip.SuspendLayout()
            
Me.SuspendLayout()
            
'
            'MainToolStripContainer
            '
            Me.MainToolStripContainer.BottomToolStripPanelVisible = False
            
'
            'MainToolStripContainer.ContentPanel
            '
            Me.MainToolStripContainer.ContentPanel.Size = New System.Drawing.Size(275129)
            
Me.MainToolStripContainer.Dock = System.Windows.Forms.DockStyle.Fill
            
Me.MainToolStripContainer.LeftToolStripPanelVisible = False
            
Me.MainToolStripContainer.Location = New System.Drawing.Point(00)
            
Me.MainToolStripContainer.Name = "MainToolStripContainer"
            
Me.MainToolStripContainer.RightToolStripPanelVisible = False
            
Me.MainToolStripContainer.Size = New System.Drawing.Size(275179)
            
Me.MainToolStripContainer.TabIndex = 0
            
Me.MainToolStripContainer.Text = "ToolStripContainer1"
            
'
            'MainToolStripContainer.TopToolStripPanel
            '
            Me.MainToolStripContainer.TopToolStripPanel.BackColor = System.Drawing.SystemColors.InactiveCaption
            
Me.MainToolStripContainer.TopToolStripPanel.Controls.Add(Me.gTopToolStrip)
            
Me.MainToolStripContainer.TopToolStripPanel.Controls.Add(Me.gMenuToolStrip)
            
'
            'gTopToolStrip
            '
            Me.gTopToolStrip.AllowMerge = False
            
Me.gTopToolStrip.BackColor = System.Drawing.SystemColors.InactiveCaption
            
Me.gTopToolStrip.Dock = System.Windows.Forms.DockStyle.None
            
Me.gTopToolStrip.Font = System.Drawing.SystemFonts.SmallCaptionFont
            
Me.gTopToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
            
Me.gTopToolStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripLabelText, Me.ToolStripButtonClose})
            
Me.gTopToolStrip.Location = New System.Drawing.Point(00)
            
Me.gTopToolStrip.Name = "gTopToolStrip"
            
Me.gTopToolStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.System
            
Me.gTopToolStrip.Size = New System.Drawing.Size(27525)
            
Me.gTopToolStrip.Stretch = True
            
Me.gTopToolStrip.TabIndex = 0
            
'
            'ToolStripLabelText
            '
            Me.ToolStripLabelText.ForeColor = System.Drawing.SystemColors.InactiveCaptionText
            
Me.ToolStripLabelText.Name = "ToolStripLabelText"
            
Me.ToolStripLabelText.Size = New System.Drawing.Size(2922)
            
Me.ToolStripLabelText.Size = System.Windows.Forms.SystemInformation.ToolWindowCaptionButtonSize
            
Me.ToolStripLabelText.Text = "名称"
            
Me.ToolStripLabelText.Font = System.Drawing.SystemFonts.MenuFont
            
'
            'ToolStripButtonClose
            '
            Me.ToolStripButtonClose.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right
            
Me.ToolStripButtonClose.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text
            
Me.ToolStripButtonClose.ImageTransparentColor = System.Drawing.Color.Magenta
            
Me.ToolStripButtonClose.Name = "ToolStripButtonClose"
            
Me.ToolStripButtonClose.Size = System.Windows.Forms.SystemInformation.ToolWindowCaptionButtonSize
            
Me.ToolStripButtonClose.Text = "A"
            
Me.ToolStripButtonClose.ToolTipText = "关闭"
            
Me.ToolStripButtonClose.Font = System.Drawing.SystemFonts.MenuFont
            
'
            'gMenuToolStrip
            '
            Me.gMenuToolStrip.AllowMerge = False
            
Me.gMenuToolStrip.Dock = System.Windows.Forms.DockStyle.None
            
Me.gMenuToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
            
Me.gMenuToolStrip.Location = New System.Drawing.Point(025)
            
Me.gMenuToolStrip.Name = "gMenuToolStrip"
            
Me.gMenuToolStrip.Size = New System.Drawing.Size(27525)
            
Me.gMenuToolStrip.Stretch = True
            
Me.gMenuToolStrip.TabIndex = 1
            
'
            'ToolPanel
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
            
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            
Me.Controls.Add(Me.MainToolStripContainer)
            
Me.Name = "ToolPanel"
            
Me.Size = New System.Drawing.Size(275179)
            
Me.MainToolStripContainer.TopToolStripPanel.ResumeLayout(False)
            
Me.MainToolStripContainer.TopToolStripPanel.PerformLayout()
            
Me.MainToolStripContainer.ResumeLayout(False)
            
Me.MainToolStripContainer.PerformLayout()
            
Me.gTopToolStrip.ResumeLayout(False)
            
Me.gTopToolStrip.PerformLayout()
            
Me.ResumeLayout(False)

        End Sub
        
Private WithEvents ToolStripButtonClose As System.Windows.Forms.ToolStripButton
        
Private WithEvents ToolStripLabelText As System.Windows.Forms.ToolStripLabel
        
Private WithEvents gTopToolStrip As System.Windows.Forms.ToolStrip
        
Protected Friend WithEvents gMenuToolStrip As System.Windows.Forms.ToolStrip
        
Protected Friend WithEvents MainToolStripContainer As System.Windows.Forms.ToolStripContainer

    End Class
End Namespace

抱歉!评论已关闭.