所有者绘图意味着我必须编写自己的绘图方法。
但是,如果没有文本,我如何让系统绘制我的ListView项目的“系统”背景?我想手动绘制文本,而不是(蓝色)背景。
Protected Overrides Sub OnDrawItem(ByVal e As System.Windows.Forms.DrawListViewItemEventArgs)
MyBase.OnDrawItem(e)
e.DrawBackground()
TextRenderer.DrawText(e.Graphics, "My Text", e.Item.Font, e.Bounds, e.Item.ForeColor)
End Sub使用ListView在Tile视图中,我只看到“我的文本”。
发布于 2011-09-11 12:39:22
Protected Overrides Sub OnDrawItem(ByVal e As DrawListViewItemEventArgs)
MyBase.OnDrawItem(e)
e.DrawBackground()
If (e.State And ListViewItemStates.Selected) <> 0 Then
e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds)
e.DrawFocusRectangle()
TextRenderer.DrawText(e.Graphics, "My Text", e.Item.Font, e.Bounds, SystemColors.HighlightText, Color.Empty)
Else
TextRenderer.DrawText(e.Graphics, "My Text", e.Item.Font, e.Bounds, e.Item.ForeColor)
End If
End Subhttps://stackoverflow.com/questions/7376638
复制相似问题