我正在使用Pictureboxes填充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.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
TL; DR我想删除/更改特定索引处的一个工具提示文本
答案 0 :(得分:2)
由于sender
参数是单击的图片框控件,因此您可以使用该变量指定要更改的控件。例如,这将删除工具提示:
laytt.SetToolTip(sender, Nothing)
这会改变它:
laytt.SetToolTip(sender, "new value")