LzmTW.uSystem.uWindows.uForms + GridPropertyForm

来源:互联网 发布:淘宝禁止发布的商品是 编辑:程序博客网 时间:2024/05/29 09:31

Author:水如烟  

Namespace LzmTW.uSystem.uWindows.uForms
    
Friend Class GridPropertyForm

        
Private Sub HScrollBar_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar.Scroll
            
Me.Opacity = HScrollBar.Value / 100
        
End Sub

        
Private WithEvents gDataGridView As DataGridView
        
Private gCurrentRow As DataGridViewRow
        
Private gFormatString As String = ""

        
Public Overloads Sub Show(ByVal datagridview As DataGridView)
            
Me.gDataGridView = datagridview
            
Me.Show(datagridview.FindForm)
        
End Sub

        
Private Sub gDataGridView_CurrentCellChanged(ByVal sender As ObjectByVal e As System.EventArgs) Handles gDataGridView.CurrentCellChanged
            
If gDataGridView.CurrentRow Is Nothing Then Exit Sub
            
If gDataGridView.Columns.Count = 0 Then Exit Sub

            
If gDataGridView.CurrentRow.Equals(gCurrentRow) Then Exit Sub
            gCurrentRow 
= gDataGridView.CurrentRow
            ShowRowInformation()
        
End Sub

        
Private Sub ShowRowInformation()
            
Me.RichTextBox.Clear()
            Converter.Input(gCurrentRow)
            
Me.RichTextBox.Text = Converter.ToString
        
End Sub

        
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As ObjectByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
            
If Me.TabControl1.SelectedIndex = 0 Then Exit Sub
            
If Me.gDataGridView.Columns.Count = 0 Then Exit Sub

            
Me.TreeView1.Nodes.Clear()

            
Dim mRoot As TreeNode = New TreeNode("DataGrid")

            
With mRoot

                
For Each c As DataGridViewColumn In Me.gDataGridView.Columns
                    .Nodes.Add(c.DataPropertyName)
                
Next

            
End With

            
Me.TreeView1.Nodes.Add(mRoot)

        
End Sub

        
Private Sub TreeView1_AfterSelect(ByVal sender As ObjectByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
            
If e.Node Is Nothing Then Exit Sub

            
If e.Node.Equals(Me.TreeView1.Nodes(0)) Then
                
Me.PropertyGrid1.SelectedObject = Me.gDataGridView
            
Else
                
Me.PropertyGrid1.SelectedObject = Me.gDataGridView.Columns(e.Node.Text)
            
End If
        
End Sub


        
Private Class Converter
            
Private Shared gDataGridViewRow As DataGridViewRow
            
Private Shared gRowString As String = ""

            
Public Shared Sub Input(ByVal datagridviewrow As DataGridViewRow)
                gDataGridViewRow 
= datagridviewrow
                GetString()
            
End Sub

            
Private Shared Sub GetString()
                
Dim mCount As Integer = gDataGridViewRow.DataGridView.Columns.Count
                
Dim mMaxLen As Integer = 0
                
Dim mName As String = ""

                
For index As Integer = 0 To mCount - 1
                    mName 
= gDataGridViewRow.DataGridView.Columns(index).Name
                    mMaxLen 
= Math.Max(mMaxLen, uString.Length(mName))
                
Next

                
Dim b As New System.Text.StringBuilder
                
For index As Integer = 0 To mCount - 1
                    b.AppendLine(uString.PadLeft(gDataGridViewRow.DataGridView.Columns(index).Name, mMaxLen) 
& "" & gDataGridViewRow.Cells(index).Value.ToString)
                
Next

                gRowString 
= b.ToString
            
End Sub

            
Public Overloads Shared Function ToString() As String
                
Return gRowString
            
End Function

        
End Class

    
End Class
End Namespace

 

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

        
'Form 重写 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.TabControl1 = New System.Windows.Forms.TabControl
            
Me.TabPage1 = New System.Windows.Forms.TabPage
            
Me.Label1 = New System.Windows.Forms.Label
            
Me.HScrollBar = New System.Windows.Forms.HScrollBar
            
Me.RichTextBox = New System.Windows.Forms.RichTextBox
            
Me.TabPage2 = New System.Windows.Forms.TabPage
            
Me.PropertyGrid1 = New System.Windows.Forms.PropertyGrid
            
Me.TreeView1 = New System.Windows.Forms.TreeView
            
Me.TabControl1.SuspendLayout()
            
Me.TabPage1.SuspendLayout()
            
Me.TabPage2.SuspendLayout()
            
Me.SuspendLayout()
            
'
            'TabControl1
            '
            Me.TabControl1.Controls.Add(Me.TabPage1)
            
Me.TabControl1.Controls.Add(Me.TabPage2)
            
Me.TabControl1.Dock = System.Windows.Forms.DockStyle.Fill
            
Me.TabControl1.Location = New System.Drawing.Point(00)
            
Me.TabControl1.Name = "TabControl1"
            
Me.TabControl1.SelectedIndex = 0
            
Me.TabControl1.Size = New System.Drawing.Size(550424)
            
Me.TabControl1.TabIndex = 0
            
'
            'TabPage1
            '
            Me.TabPage1.Controls.Add(Me.Label1)
            
Me.TabPage1.Controls.Add(Me.HScrollBar)
            
Me.TabPage1.Controls.Add(Me.RichTextBox)
            
Me.TabPage1.Location = New System.Drawing.Point(421)
            
Me.TabPage1.Name = "TabPage1"
            
Me.TabPage1.Padding = New System.Windows.Forms.Padding(3)
            
Me.TabPage1.Size = New System.Drawing.Size(542399)
            
Me.TabPage1.TabIndex = 0
            
Me.TabPage1.Text = "当前行数据"
            
Me.TabPage1.UseVisualStyleBackColor = True
            
'
            'Label1
            '
            Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            
Me.Label1.AutoSize = True
            
Me.Label1.Location = New System.Drawing.Point(371382)
            
Me.Label1.Name = "Label1"
            
Me.Label1.Size = New System.Drawing.Size(6512)
            
Me.Label1.TabIndex = 4
            
Me.Label1.Text = "调整透明度"
            
'
            'HScrollBar
            '
            Me.HScrollBar.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            
Me.HScrollBar.Location = New System.Drawing.Point(439374)
            
Me.HScrollBar.Maximum = 105
            
Me.HScrollBar.Minimum = 20
            
Me.HScrollBar.Name = "HScrollBar"
            
Me.HScrollBar.Size = New System.Drawing.Size(9820)
            
Me.HScrollBar.TabIndex = 3
            
Me.HScrollBar.Value = 105
            
'
            'RichTextBox
            '
            Me.RichTextBox.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                        
Or System.Windows.Forms.AnchorStyles.Left) _
                        
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            
Me.RichTextBox.BackColor = System.Drawing.SystemColors.Info
            
Me.RichTextBox.Location = New System.Drawing.Point(00)
            
Me.RichTextBox.Name = "RichTextBox"
            
Me.RichTextBox.Size = New System.Drawing.Size(542371)
            
Me.RichTextBox.TabIndex = 1
            
Me.RichTextBox.Text = ""
            
'
            'TabPage2
            '
            Me.TabPage2.Controls.Add(Me.PropertyGrid1)
            
Me.TabPage2.Controls.Add(Me.TreeView1)
            
Me.TabPage2.Location = New System.Drawing.Point(421)
            
Me.TabPage2.Name = "TabPage2"
            
Me.TabPage2.Padding = New System.Windows.Forms.Padding(3)
            
Me.TabPage2.Size = New System.Drawing.Size(542399)
            
Me.TabPage2.TabIndex = 1
            
Me.TabPage2.Text = "表格属性"
            
Me.TabPage2.UseVisualStyleBackColor = True
            
'
            'PropertyGrid1
            '
            Me.PropertyGrid1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                        
Or System.Windows.Forms.AnchorStyles.Left) _
                        
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            
Me.PropertyGrid1.Location = New System.Drawing.Point(1920)
            
Me.PropertyGrid1.Name = "PropertyGrid1"
            
Me.PropertyGrid1.Size = New System.Drawing.Size(349399)
            
Me.PropertyGrid1.TabIndex = 1
            
'
            'TreeView1
            '
            Me.TreeView1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                        
Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
            
Me.TreeView1.Location = New System.Drawing.Point(03)
            
Me.TreeView1.Name = "TreeView1"
            
Me.TreeView1.Size = New System.Drawing.Size(184396)
            
Me.TreeView1.TabIndex = 0
            
'
            'GridPropertyForm
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
            
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            
Me.ClientSize = New System.Drawing.Size(550424)
            
Me.Controls.Add(Me.TabControl1)
            
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow
            
Me.Name = "GridPropertyForm"
            
Me.ShowInTaskbar = False
            
Me.Text = "窗格信息"
            
Me.TabControl1.ResumeLayout(False)
            
Me.TabPage1.ResumeLayout(False)
            
Me.TabPage1.PerformLayout()
            
Me.TabPage2.ResumeLayout(False)
            
Me.ResumeLayout(False)

        
End Sub
        
Friend WithEvents TabControl1 As System.Windows.Forms.TabControl
        
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
        
Friend WithEvents TabPage2 As System.Windows.Forms.TabPage
        
Private WithEvents RichTextBox As System.Windows.Forms.RichTextBox
        
Private WithEvents HScrollBar As System.Windows.Forms.HScrollBar
        
Friend WithEvents PropertyGrid1 As System.Windows.Forms.PropertyGrid
        
Friend WithEvents TreeView1 As System.Windows.Forms.TreeView
        
Friend WithEvents Label1 As System.Windows.Forms.Label
    
End Class
End Namespace
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 3岁宝宝不肯说话怎么办 两周宝宝不爱吃饭怎么办 小孩不喜欢吃水果蔬菜怎么办 孩子对学习不感兴趣怎么办 幼儿园老师不喜欢我孩子怎么办 孩子数学不主动思考问题怎么办 孩子做事慢磨蹭家长应该怎么办 孩子不写作业怎么办啊 对孩子在校被欺怎么办 二年级的孩子不爱学习怎么办 孩子不爱学习怎么办二年级 二年级孩子不爱写作业怎么办 孩子喜欢的朋友家长不喜欢怎么办? 孩子不喜欢上幼儿园家长怎么办 孩子不喜欢家长学佛怎么办呢? 学生家长讨厌老师老师该怎么办 孩子不爱去幼儿园总是哭怎么办 孩子学习一点都不主动怎么办 孩子怕老师不想上学怎么办 幼儿园孩子怕老师不想上学怎么办 孩子在幼儿园怕老师怎么办 幼儿园老师对孩子有歧视怎么办 儿子在幼儿园受到老师歧视怎么办 我把老师骂了怎么办 孩子讨厌老师骂老师怎么办 幼儿园老师讨厌一个孩子怎么办 幼儿园老师对孩子不好怎么办 高中分班讨厌班主任怎么办 把孩子老师惹了怎么办 高三班主任第一节课应该怎么办 高三孩子与班主任不和怎么办 孩子很害怕一件事怎么办 吼完孩子觉得很害怕怎么办 小朋友在幼儿园被欺负怎么办 老师总找孩子茬怎么办 小孩说幼儿园老师不喜欢她怎么办 小孩在学校老师不喜欢怎么办 好哭的孩子老师怎么办 小孩哭的犟住怎么办 2-3小孩脾气很犟怎么办 生了孩子没奶怎么办