0
ListViewのオーナードローイングに問題があります。 ListViewItemにカーソルを置くと、それらのサブアイテムは消えます。もう一度クリックすると、再び表示され、表示されます。それは最初は一度だけ起こります。これは私の現在のコードです:詳細は行を超えるときにマウスポインタが移動を表示行ごとに一度あるため、基礎となるのWin32コントロールのバグのVB.NET ListView OwnerDrawサブアイテムがホバリング時に消えます
Private Sub ListView1_DrawItem(sender As Object, e As DrawListViewItemEventArgs) Handles ListView1.DrawItem
If (e.State And ListViewItemStates.Selected) <> 0 Then
e.Graphics.FillRectangle(Brushes.Violet, e.Bounds)
Dim cBounds As Rectangle = e.Bounds
cBounds.X = cBounds.X + 6
e.Graphics.DrawString(e.Item.Text, New Font("Segoe UI", 9.25, FontStyle.Bold), Brushes.White, cBounds)
Else
e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(255, 25, 25, 25)), e.Bounds)
Dim cBounds As Rectangle = e.Bounds
cBounds.X = cBounds.X + 6
e.Graphics.DrawString(e.Item.Text, New Font("Segoe UI", 9.25), Brushes.White, cBounds)
End If
End Sub
Private Sub ListView1_DrawSubItem(sender As Object, e As DrawListViewSubItemEventArgs) Handles ListView1.DrawSubItem
If (e.ItemState And ListViewItemStates.Selected) <> 0 Then
e.Graphics.FillRectangle(Brushes.Violet, e.Bounds)
Dim cBounds As Rectangle = e.Bounds
cBounds.X = cBounds.X + 6
e.Graphics.DrawString(e.Item.Text, New Font("Segoe UI", 9.25, FontStyle.Bold), Brushes.White, cBounds)
Else
e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(255, 25, 25, 25)), e.Bounds)
Dim cBounds As Rectangle = e.Bounds
cBounds.X = cBounds.X + 6
e.Graphics.DrawString(e.Item.Text, New Font("Segoe UI", 9.25), Brushes.White, cBounds)
End If
End Sub
あなたが投稿したコードは、この問題を再現しません。 MouseHoverイベントまたは他のマウスイベントにコードがありますか? – LarsTech