Hi all,
I have done some work to create a floating textbox above a listview. It currently floats over the first column:
This part seems pretty straight foward. What I can't seem to figure out is how to save the textbox changes. I have tried using various leave/focus options of the listview; however, since the textbox itself has the focus, the listview's options don't seem to work.
I guess I have some questions:
1) Would I be able to use the listview's leave/focus options if I used the setparent option, to change the parent of the textbox from the form, to the listview? - I just thought of this.
2) Is there another way?
I have done some work to create a floating textbox above a listview. It currently floats over the first column:
Code:
Private Sub lst_PlayersAll_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lst_PlayersAll.MouseUp
' bont is the listbox
Dim MyItem As ListViewItem = lst_PlayersAll.SelectedItems(0)
If Not IsNothing(MyItem) Then
Dim ClickedItem As Rectangle = MyItem.Bounds
ClickedItem.X += Me.lst_PlayersAll.Left + GroupBox1.Left + 1
ClickedItem.Y += Me.lst_PlayersAll.Top + GroupBox1.Top + 1
bont.Height = MyItem.Bounds.Height
ClickedItem.Width = lst_PlayersAll.Columns(0).Width
bont.Bounds = ClickedItem
bont.Text = MyItem.Text
bont.Visible = True
bont.BringToFront()
bont.Focus()
End If
End Sub
Private Sub bont_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles bont.KeyUp
If e.KeyCode = Keys.Escape Then
bont.Visible = False
End If
End Sub
This part seems pretty straight foward. What I can't seem to figure out is how to save the textbox changes. I have tried using various leave/focus options of the listview; however, since the textbox itself has the focus, the listview's options don't seem to work.
I guess I have some questions:
1) Would I be able to use the listview's leave/focus options if I used the setparent option, to change the parent of the textbox from the form, to the listview? - I just thought of this.
2) Is there another way?