以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]控件动态提示信息 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=29273) |
-- 作者:xvkewen -- 发布时间:2013/3/3 20:57:00 -- [求助]控件动态提示信息 如下图,有文件的地方是用CreateControl动态增加的LABLE控件,增加时我也设置了提示代码,我在全局代码里设置了当鼠标移动控件提示,但预览是怎么不提示呀? 代码是写的Afterload事件里的。 Dim xm As String = DataTables("项目").DataRows(0)("项目") Dim gx As String Dim drs As List (of DataRow) = DataTables("工序").Select("项目 = \'" & xm & "\'" ,"工序") Dim x,y,i As Integer \'定义控件的位移大小 x = 0 y = 0 i = 1 Dim lbl As WinForm.Label For Each dr As DataRow In drs lbl = e.Form.CreateControl("lable" & i, ControlTypeEnum.Label) lbl.AutoSize = True lbl.Text = dr("工序") lbl.ToolTip = dr("工序") & "内容" lbl.Left = 100 + x lbl.Top = 100 If dr("是否完成") = True Then lbl.BackColor = color.red End If e.Form.AddControl(lbl) i = i+1 x = x + 100 Next [此贴子已经被作者于2013-3-3 22:43:38编辑过]
|
-- 作者:xvkewen -- 发布时间:2013/3/3 22:03:00 -- 我的全局事件设置了:e.sender.showToolTip(e.sender.tooltip),就是取不到上面设置的值。 lbl.ToolTip = dr("工序") & "内容" |
-- 作者:狐狸爸爸 -- 发布时间:2013/3/4 9:00:00 -- Dim B2 As WinForm.Button = e.Form.Controls("Button2") B2.ToolTip = "提示内容2" Dim xm As String = DataTables("项目").DataRows(0)("项目") Dim gx As String Dim drs As List (of DataRow) = DataTables("工序").Select("项目 = \'" & xm & "\'" ,"工序") Dim x,y,i As Integer \'定义控件的位移大小 x = 0 y = 0 i = 1 Dim lbl As WinForm.Label For Each dr As DataRow In drs lbl = e.Form.CreateControl("lable" & i, ControlTypeEnum.Label) lbl. BorderStyle = BorderStyle.FixedSingle lbl.TextAlign = ContentAlignment.middlecenter lbl.AutoSize = True lbl.Text = dr("工序") lbl.Left = 100 + x lbl.Top = 100 If dr("是否完成") = True Then lbl.BackColor = color.green End If e.Form.AddControl(lbl) i = i+1 x = x + 100 lbl.ToolTip = dr("工序") & "内容" Next |
-- 作者:xvkewen -- 发布时间:2013/3/4 10:12:00 -- 谢谢狐爸,我明白了;之前赋值时控件还没有添加到窗口,所以设置了也没用; |
-- 作者:blackzhu -- 发布时间:2013/3/4 10:20:00 -- 哦 原来是这样的 终于学会了 |