Vb.net 如何仅更改一个工具提示?
我正在用图片框填充FlowLayout。当我填充时,我会给他们每个人一个工具提示。我有一个单独的功能来更改图片我怎样才能更改工具提示呢Vb.net 如何仅更改一个工具提示?,vb.net,tooltip,Vb.net,Tooltip,我正在用图片框填充FlowLayout。当我填充时,我会给他们每个人一个工具提示。我有一个单独的功能来更改图片我怎样才能更改工具提示呢 dim laytt as tooltip = new tooltip For i = 1 To count Dim newPic As PictureBox = New PictureBox() newPic.Image = p.Image newPic.Size = p.Size newPic.
dim laytt as tooltip = new tooltip
For i = 1 To count
Dim newPic As PictureBox = New PictureBox()
newPic.Image = p.Image
newPic.Size = p.Size
newPic.SizeMode = p.SizeMode
laytt.SetToolTip(newPic, ttstring)
AddHandler newPic.Click, AddressOf LayoutComponent_Clicked
sys.Add(a_component)
LayoutFlowLayout.Controls.Add(newPic)
Next
后来我有一个功能,以改变它的图片我想能够改变工具提示
Private Sub LayoutComponent_Clicked(ByVal sender As Object, ByVal e As EventArgs)
Dim i As Integer = LayoutFlowLayout.Controls.IndexOf(sender)
If deleteModeOn Then
sys.components.RemoveAt(i)
LayoutFlowLayout.Controls.RemoveAt(i)
Exit Sub
End If
'get index in sys from layout?
If (sys.components.Item(i).GetType() = GetType(Transpositor)) Then
Form2.ShowDialog(Me)
sys.components.Item(i).divert = tempTranspositorDivert
'here I want to do something like this
laytt.RemoveAt(i) <--- THIS DOESN'T EXIST
End If
End Sub
Private Sub LayoutComponent_单击(ByVal sender作为对象,ByVal e作为事件参数)
Dim i作为整数=LayoutFlowLayout.Controls.IndexOf(发送方)
如果你继续,那么
系统部件拆卸(一)
LayoutFlowLayout.Controls.RemoveAt(i)
出口接头
如果结束
'从布局中获取系统中的索引?
如果(sys.components.Item(i).GetType()=GetType(Transpositor)),那么
表格2.ShowDialog(Me)
系统组件项(i).divert=DentTranspositorInvert
“在这里,我想做这样的事情
laytt.RemoveAt(i)由于sender
参数是单击的图片框控件,因此可以使用该变量指定要更改的控件。例如,这将删除工具提示:
laytt.SetToolTip(sender, Nothing)
这将改变它:
laytt.SetToolTip(sender, "new value")
不,这实际上添加了一个新的工具提示。因此,在这一点上,我会在同一个发件人上有两个工具提示。奇怪吧?根据MSDN不应该这样,而且在我的快速测试中也没有添加另一个。