Просьба помочь мне код, чтобы выделить элемент ListView при наведении мыши на языке C# (winform)
Меню игры CSM - YouTube[^]
How do I show a rectangle around listviewItem when I hover the mouse over it like in the video? I use mousehover / mousemove event. I need a sample code (C# - WinForm) that can do that. Sorry I use google translate
Что я уже пробовал:
my listview item have image and text. How to show image and text in DrawItem private void listView1_DrawItem(object sender, DrawListViewItemEventArgs e) { Color textColor = SystemColors.WindowText; if (e.Item.Selected) { if (listView1.Focused) { textColor = SystemColors.HighlightText; e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds); } else if (!listView1.HideSelection) { textColor = SystemColors.ControlText; e.Graphics.FillRectangle(SystemBrushes.Control, e.Bounds); } } else { using (SolidBrush br = new SolidBrush(listView1.BackColor)) { e.Graphics.FillRectangle(br, e.Bounds); } } e.Graphics.DrawRectangle(Pens.Red, e.Bounds); TextRenderer.DrawText(e.Graphics, e.Item.Text, listView1.Font, e.Bounds, textColor, Color.Empty, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter); }