private void lvListing_DrawSubItem(object sender, DrawListViewSubItemEventArgs e) { //e.Graphics.FillRectangle(Brushes.LightGray, e.Bounds); // Use default drawing routine if this cell doesn't contain html. if (!e.SubItem.Text.Contains("<")) { //e.DrawBackground(); //e.DrawFocusRectangle(e.SubItem.Bounds); e.DrawDefault = true; return; } #if false Point pt=e.Bounds.Location; pt =lvListing.PointToScreen(pt); pt=this.PointToClient(pt); linkLabel1.Location = pt; linkLabel1.Size = e.Bounds.Size; return; #endif //e.DrawFocusRectangle(e.Bounds); //e.DrawBackground(); if (e.Item.Selected) { //e.Graphics.FillRectangle(Brushes.LightGray, e.Bounds); //e.Graphics.DrawRectangle(Pens.Gray, e.Bounds); } Rectangle rect = e.Item.GetSubItemBounds(e.ColumnIndex); HtmlRenderer renderer = new HtmlRenderer( e.SubItem.Text, e.SubItem.Font, linkHoverFont); renderer.Measure(e.Graphics, rect); renderer.Draw(e.Graphics, lvListing.PointToClient(Cursor.Position)); }
private void lvListing_MouseMove(object sender, MouseEventArgs e) { var ht = lvListing.HitTest(e.Location); if (ht.Item != lastItem) { if (lastItem != null && lastItem.Index < lvListing.Items.Count) lvListing.RedrawItems(lastItem.Index, lastItem.Index, true); if (ht.Item != null) lvListing.RedrawItems(ht.Item.Index, ht.Item.Index, true); lastItem = ht.Item; } // Update cursor shape. if (ht.Item == null || ht.SubItem == null) { lvListing.Cursor = Cursors.Default; } else { HtmlRenderer renderer = new HtmlRenderer( ht.SubItem.Text, ht.SubItem.Font, linkHoverFont); using (Graphics g = lvListing.CreateGraphics()) { renderer.Measure(g, ht.SubItem.Bounds); // TBD: if ColumnIndex == 0... if (renderer.HitTest(e.Location)) { lvListing.Cursor = Cursors.Hand; return; } } lvListing.Cursor = Cursors.Default; } #if false // Display a tool-tip for an instruction. if (ht.SubItem != null && ht.SubItem.Text.Contains(" _")) { using (Graphics g = lvListing.CreateGraphics()) { TextWithInfo[] texts = MeasureSubItemTexts(g, ht.SubItem); //System.Diagnostics.Debug.WriteLine("Checking..."); if (texts.Length > 0 && texts[0].Bounds.Contains(e.Location)) { if (opcodeToolTip == null) opcodeToolTip = new ToolTip(); Rectangle r = ht.SubItem.Bounds; Point ptToolTip = new Point(r.Left, r.Bottom); opcodeToolTip.Show(texts[0].Text, lvListing, ptToolTip, 1000); //ht.SubItem. } } } #endif }
private void lvListing_MouseMove(object sender, MouseEventArgs e) { var ht = lvListing.HitTest(e.Location); if (ht.Item != lastItem) { if (lastItem != null && lastItem.Index < lvListing.Items.Count) { lvListing.RedrawItems(lastItem.Index, lastItem.Index, true); } if (ht.Item != null) { lvListing.RedrawItems(ht.Item.Index, ht.Item.Index, true); } lastItem = ht.Item; } // Update cursor shape. if (ht.Item == null || ht.SubItem == null) { lvListing.Cursor = Cursors.Default; } else { HtmlRenderer renderer = new HtmlRenderer( ht.SubItem.Text, ht.SubItem.Font, linkHoverFont); using (Graphics g = lvListing.CreateGraphics()) { renderer.Measure(g, ht.SubItem.Bounds); // TBD: if ColumnIndex == 0... if (renderer.HitTest(e.Location)) { lvListing.Cursor = Cursors.Hand; return; } } lvListing.Cursor = Cursors.Default; } #if false // Display a tool-tip for an instruction. if (ht.SubItem != null && ht.SubItem.Text.Contains(" _")) { using (Graphics g = lvListing.CreateGraphics()) { TextWithInfo[] texts = MeasureSubItemTexts(g, ht.SubItem); //System.Diagnostics.Debug.WriteLine("Checking..."); if (texts.Length > 0 && texts[0].Bounds.Contains(e.Location)) { if (opcodeToolTip == null) { opcodeToolTip = new ToolTip(); } Rectangle r = ht.SubItem.Bounds; Point ptToolTip = new Point(r.Left, r.Bottom); opcodeToolTip.Show(texts[0].Text, lvListing, ptToolTip, 1000); //ht.SubItem. } } } #endif }