首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

vb.net初级有关问题,listview中的列怎么去掉突出显示的那个虚框

2012-07-31 
vb.net初级问题,listview中的列如何去掉突出显示的那个虚框!这属性太多了,挨个试也没找到答案,就是想启动

vb.net初级问题,listview中的列如何去掉突出显示的那个虚框!

这属性太多了,挨个试也没找到答案,就是想启动程序后,没有那个虚线框,如图示,请高手指点。谢谢先

[解决办法]
继承一个listview,重绘
[解决办法]
http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.drawitem.aspx

VB.NET code
' Draws the backgrounds for entire ListView items.Private Sub listView1_DrawItem(ByVal sender As Object, _    ByVal e As DrawListViewItemEventArgs) _    Handles listView1.DrawItem    If Not (e.State And ListViewItemStates.Selected) = 0 Then        ' Draw the background for a selected item.        e.Graphics.FillRectangle(Brushes.Maroon, e.Bounds)        e.DrawFocusRectangle()'这一行就是你说的虚线,删掉或注释掉就没有虚线了。    Else        ' Draw the background for an unselected item.        Dim brush As New LinearGradientBrush(e.Bounds, Color.Orange, _            Color.Maroon, LinearGradientMode.Horizontal)        Try            e.Graphics.FillRectangle(brush, e.Bounds)        Finally            brush.Dispose()        End Try    End If    ' Draw the item text for views other than the Details view.    If Not Me.listView1.View = View.Details Then        e.DrawText()    End IfEnd Sub 

热点排行