listview 的 Columnheader 怎么改变颜色

yuqi508 2005-12-03 08:52:06


listview 的 view 设为details后

listview 的 Columnheader 怎么改变颜色
...全文
242 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhouqinppq0830 2010-06-04
  • 打赏
  • 举报
回复
设置该listview的owerDraw属性为true,然后

Private Sub ListView1_DrawColumnHeader(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawListViewColumnHeaderEventArgs) Handles ListView1.DrawColumnHeader
Dim strFormat As New StringFormat()


If e.Header.TextAlign = HorizontalAlignment.Center Then
strFormat.Alignment = StringAlignment.Center
ElseIf e.Header.TextAlign = HorizontalAlignment.Right Then
strFormat.Alignment = StringAlignment.Far
End If

e.DrawBackground()
e.Graphics.FillRectangle(Brushes.SteelBlue, e.Bounds)
Dim headerFont As New Font("Arial", 8, FontStyle.Bold)

e.Graphics.DrawString(e.Header.Text, headerFont, Brushes.White, e.Bounds, strFormat)


End Sub
MyLf 2005-12-12
  • 打赏
  • 举报
回复
不太可能做。
ListView的ColumnHeader是最差劲的东东,什么也扩展不了。

不知2005的有没有改善
SqlDataAdapter 2005-12-07
  • 打赏
  • 举报
回复
楼上的画一个贴出来让大家学习学习。
SeeSunSet 2005-12-03
  • 打赏
  • 举报
回复
只有自己继承此控件,然后覆写PAINT方法,自己画.

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧