以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 第三方的代码 这个咋改? 也是论坛BIn的例子 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=39961) |
-- 作者:blackzhu -- 发布时间:2013/9/5 16:15:00 -- 第三方的代码 这个咋改? 也是论坛BIn的例子 Dim ts As new Windows.Forms.ToolStrip Dim tsi As new Windows.Forms.ToolStripDropDownButton("页面集合") Dim tsi1 As new Windows.Forms.ToolStripButton("页面1") Dim tsi2 As new Windows.Forms.ToolStripButton("页面2") Dim tsi3 As new Windows.Forms.ToolStripButton("页面3") AddHandler tsi1.Click, AddressOf Button_Click AddHandler tsi2 .Click, AddressOf Button_Click AddHandler tsi3 .Click, AddressOf Button_Click tsi.DropDownItems.Add(tsi1) tsi.DropDownItems.Add(tsi2) tsi.DropDownItems.Add(tsi3) ts.Items.Add(tsi) e.Form.baseform.Controls.Add(ts) 这个代码我用表直接设置但是不行: Dim ts As new Windows.Forms.ToolStrip Dim tsi As new Windows.Forms.ToolStripDropDownButton Dim s As String Dim drs As List(Of DataRow) s = DataTables("表C").GetComboListString("第一列") Dim Values() As String = s.Split("|") For i As Integer = 0 To Values.Length -1 ts.Items.Add(Values(i)) drs = DataTables("表C").Select("[第一列] = \'" & Values(i) & "\'") For Each dr As DataRow In drs ts.Items(Values(i)).DropDownItems.Add(dr("第二列")) 这一句通不过应该咋改? Next Next e.Form.baseform.Controls.Add(ts) |
-- 作者:Bin -- 发布时间:2013/9/5 16:24:00 -- 应该先声明添加了子项 再用TS添加. Dim ts As new Windows.Forms.ToolStrip Dim tsi As new Windows.Forms.ToolStripDropDownButton Dim s As String Dim drs As List(Of DataRow) s = DataTables("表C").GetComboListString("第一列") Dim Values() As String = s.Split("|") For i As Integer = 0 To Values.Length -1 Dim tsi As new Windows.Forms.ToolStripDropDownButton(Values(i)) drs = DataTables("表C").Select("[第一列] = \'" & Values(i) & "\'") For Each dr As DataRow In drs tsi.DropDownItems.Add(dr("第二列")) 这一句通不过应该咋改? Next ts.Items.Add(tsi) Next e.Form.baseform.Controls.Add(ts) |
-- 作者:blackzhu -- 发布时间:2013/9/5 16:28:00 -- 搞定了! 代码如下" Dim ts As new Windows.Forms.ToolStrip e.Form.baseform.Controls.Add(ts) Dim tsi As System.Windows.Forms.ToolStripDropDownButton Dim s As String Dim drs As List(Of DataRow) s = DataTables("表C").GetComboListString("第一列") Dim Values() As String = s.Split("|") For i As Integer = 0 To Values.Length -1 tsi = New System.Windows.Forms.ToolStripDropDownButton(Values(i)) drs = DataTables("表C").Select("[第一列] = \'" & Values(i) & "\'") For Each dr As DataRow In drs tsi.DropDownItems.Add(dr("第二列")) Next ts.Items.Add(tsi) Next |
-- 作者:blackzhu -- 发布时间:2013/9/5 16:29:00 -- 哈哈 一个马后炮. 问下工具栏的三个点咋去掉? |
-- 作者:Bin -- 发布时间:2013/9/5 16:36:00 -- 哪三个点? 另外这个是可以穿图片参数的. tsi.DropDownItems.Add(dr("第二列"),GetImage("C:\\1.jpg\'))
|
-- 作者:blackzhu -- 发布时间:2013/9/5 16:38:00 -- GripStyle 这个属性 |
-- 作者:Bin -- 发布时间:2013/9/5 16:49:00 -- ts.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; |
-- 作者:jianjingmaoyi -- 发布时间:2013/9/6 19:41:00 -- Dim ts As new Windows.Forms.ToolStrip ts.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden e.Form.baseform.Controls.Add(ts) Dim tsi As System.Windows.Forms.ToolStripDropDownButton Dim s As String Dim drs As List(Of DataRow) s = DataTables("表C").GetComboListString("第一列") Dim Values() As String = s.Split("|") For i As Integer = 0 To Values.Length -1 tsi = New System.Windows.Forms.ToolStripDropDownButton(Values(i)) drs = DataTables("表C").Select("[第一列] = \'" & Values(i) & "\'") For Each dr As DataRow In drs tsi.DropDownItems.Add(dr("第二列")) Next ts.Items.Add(tsi) AddHandler ts.Click, AddressOf Button_Click 这个地方这么写? Next |
-- 作者:有点甜 -- 发布时间:2013/9/6 19:45:00 -- 以下是引用jianjingmaoyi在2013-9-6 19:41:00的发言: Dim ts As new Windows.Forms.ToolStrip ts.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden e.Form.baseform.Controls.Add(ts) Dim tsi As System.Windows.Forms.ToolStripDropDownButton Dim s As String Dim drs As List(Of DataRow) s = DataTables("表C").GetComboListString("第一列") Dim Values() As String = s.Split("|") For i As Integer = 0 To Values.Length -1 tsi = New System.Windows.Forms.ToolStripDropDownButton(Values(i)) drs = DataTables("表C").Select("[第一列] = \'" & Values(i) & "\'") For Each dr As DataRow In drs tsi.DropDownItems.Add(dr("第二列")) Next ts.Items.Add(tsi) AddHandler ts.Click, AddressOf Button_Click 这个地方这么写? Next 参考
|
-- 作者:jianjingmaoyi -- 发布时间:2013/9/6 20:00:00 -- 这个我知道 问题 是下拉按钮 不知道怎么写了?
原来的代码是这样的
Dim ts As new Windows.Forms.ToolStrip |