-1

我正在使用图片框填充 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 我只想删除/更改特定索引处的一个工具提示文本

4

1 回答 1

2

由于sender参数是被单击的图片框控件,您可以使用该变量来指定要更改的控件。例如,这将删除工具提示:

laytt.SetToolTip(sender, Nothing)

这将改变它:

laytt.SetToolTip(sender, "new value")
于 2012-10-05T15:58:15.997 回答