本文介绍了如何从formload中绘制listview列和行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 截至目前,我可以通过单独的活动进行此操作, 这里是我正在使用的代码: as of now I am able to do this from a separate event, here is the code I am using:Private Sub ListView1_DrawSubItem(sender As Object, e As System.Windows.Forms.DrawListViewSubItemEventArgs) Handles ListView1.DrawSubItem With e.Graphics .DrawLines(New Pen(SystemColors.ButtonShadow), New Point() {New Point(e.Bounds.Left, e.Bounds.Top - 1), New Point(e.Bounds.Left + e.Bounds.Width, e.Bounds.Top - 1), New Point(e.Bounds.Left + e.Bounds.Width, e.Bounds.Top + e.Bounds.Height), New Point(e.Bounds.Left, e.Bounds.Top + e.Bounds.Height)}) End With e.DrawText() End Sub 我试图将其转移到form_load事件的原因是,每当我调用listview1.click事件时,listview会一直闪烁。但是,我相信这可能会停止,如果这是永久性地在listview上绘制而不是每次都被绘制它自己的事件。 我尝试过: 我尝试使用creategraphics 这里是我试过的代码: The reason I am trying to get this over to the form_load event is that every time I call forth my listview1.click event the listview keeps flashing. However, I believe this may stop if this was drawn on listview permanently instead of being its own event being drawn every time.What I have tried:I tried using a creategraphicshere is the code I tried:With CreateGraphics() .DrawLines(New Pen(SystemColors.ButtonShadow), New Point() {New Point(ListView1.Bounds.Left, ListView1.Bounds.Top - 1), New Point(ListView1.Bounds.Left + ListView1.Bounds.Width, ListView1.Bounds.Top - 1), New Point(ListView1.Bounds.Left + ListView1.Bounds.Width, ListView1.Bounds.Top + ListView1.Bounds.Height), New Point(ListView1.Bounds.Left, ListView1.Bounds.Top + ListView1.Bounds.Height)}) End With 但它不起作用but it didn't work推荐答案 Protected Overloads Overrides ReadOnly Property CreateParams() As CreateParams 'stop flicker code part 1 of 2 Get Dim cp As CreateParams = MyBase.CreateParams cp.ExStyle = cp.ExStyle Or 33554432 Return cp End Get End Property Private Sub PreVentFlicker() 'stop flicker code part 2 of 2 With Me .SetStyle(ControlStyles.OptimizedDoubleBuffer, True) .SetStyle(ControlStyles.UserPaint, True) .SetStyle(ControlStyles.AllPaintingInWmPaint, True) .UpdateStyles() End With End Sub b $ b http://www.dreamincode.net/forums/topic/294248-flicker-problem-on-form-loading/ http://www.dreamincode.net/forums/topic/294248-flicker-problem-on-form-loading/ 这篇关于如何从formload中绘制listview列和行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-31 06:34