-- 作者:lyfxybc
-- 发布时间:2015/9/12 7:36:00
-- [分享]“取消隐藏列”窗口的修改使用
系统自带的“取消隐藏列”方便好使,就是一点用"sys_"系统列还显示出来,有时候设计人员并不想部分列全部显示给用户,就需要特殊处理,下面就给出在“取消隐藏列”窗口把不想显示的列永久隐藏起来(进入数据库还是能看见的)
官方可以修改一下原有的“取消隐藏列”窗口
今天无法上传图片,窗口设计和系统自带的一样。设计成“独立”或“模式”即可
代码如下:
取消隐藏列_AfterLoad
Dim tv As WinForm.TreeView = e.Form.Controls("TreeView1")
For Each c As Col In CurrentTable.Cols
Dim nd As WinForm.TreeNode = tv.Nodes.Add(c.Name)
nd.Checked = c.Visible
\'下面三行不显示隐藏的列。想显示就去掉
If nd.Checked = False Then
nd.Delete
End If
Next
\'下面五行不显示系统列。
For Each nd1 As WinForm.TreeNode In tv.AllNodes
If nd1.Text.IndexOf("sys_") >= 0 Then
nd1.Delete()
End If
Next
取消隐藏列_Bt反选_Click
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
For Each nd As WinForm.TreeNode In trv.AllNodes
nd.Checked = False
Next
取消隐藏列_Bt取消_Click
e.Form.Close()
取消隐藏列_Bt全选_Click
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
For Each nd As WinForm.TreeNode In trv.AllNodes
nd.Checked = True
Next
取消隐藏列_Bt确定_Click
Dim tv As WinForm.TreeView = e.Form.Controls("TreeView1")
For Each nd As WinForm.TreeNode In tv.Nodes
If nd.Checked = False Then
For Each c As Col In CurrentTable.Cols
If c.Name = nd.Name
c.Visible = False
End If
Next
End If
Next
For Each nd As WinForm.TreeNode In tv.Nodes
If nd.Checked = True Then
For Each c As Col In CurrentTable.Cols
If c.Name = nd.Name
c.Visible = True
End If
Next
End If
Next
显示系统列
CheckedChanged
If e.Form.Controls("系统列").checked =True Then Dim tv As WinForm.TreeView = e.Form.Controls("TreeView1") tv.Nodes.Clear For Each c As Col In CurrentTable.Cols Dim nd As WinForm.TreeNode = tv.Nodes.Add(c.Name) nd.Checked = c.Visible \'If nd.Checked = False Then \' nd.Delete \'End If Next \'For Each nd1 As WinForm.TreeNode In tv.AllNodes \' If nd1.Text.IndexOf("sys_") >= 0 Then \' nd1.Delete() \' End If \'Next ElseIf e.Form.Controls("系统列").checked =False Then Dim tv As WinForm.TreeView = e.Form.Controls("TreeView1") For Each nd1 As WinForm.TreeNode In tv.AllNodes If nd1.Text.IndexOf("sys_") >= 0 Then nd1.Delete() End If Next End If
显示隐藏列
CheckedChanged
If e.Form.Controls("隐藏列").checked =True Then Dim tv As WinForm.TreeView = e.Form.Controls("TreeView1") tv.Nodes.Clear For Each c As Col In CurrentTable.Cols Dim nd As WinForm.TreeNode = tv.Nodes.Add(c.Name) nd.Checked = c.Visible \'If nd.Checked = False Then \' nd.Delete \'End If Next For Each nd1 As WinForm.TreeNode In tv.AllNodes If nd1.Text.IndexOf("sys_") >= 0 Then nd1.Delete() End If Next ElseIf e.Form.Controls("隐藏列").checked =False Then Dim tv As WinForm.TreeView = e.Form.Controls("TreeView1") tv.Nodes.Clear For Each c As Col In CurrentTable.Cols Dim nd As WinForm.TreeNode = tv.Nodes.Add(c.Name) nd.Checked = c.Visible If nd.Checked = False Then nd.Delete End If Next
For Each nd1 As WinForm.TreeNode In tv.AllNodes If nd1.Text.IndexOf("sys_") >= 0 Then nd1.Delete() End If Next End If
此主题相关图片如下:未命名3.bmp
[此贴子已经被作者于2015/9/19 15:39:22编辑过]
|