The solution is so painfully obvious, I wish I had thought of it sooner.
In the designer, all you have to do is change your Inherits line to inherit from the ListView object and remove that Autowhatsit in the InitializeComponent function.
ucListViewDoubleBuffered.Designer.vb:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class ListViewDoubleBuffered
Inherits System.Windows.Forms.ListView
'UserControl overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
Then in the code behind, write a constructor and set its styles appropriately.
ucListViewDoubleBuffered.vb:
Imports System.Windows.Forms
Public Class ListViewDoubleBuffered
Inherits ListView
Public Sub New()
MyBase.New()
InitializeComponent()
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.Opaque, True)
End Sub
End Class
Both work in this case. Opaque vs. AllPaintingInWmPaint for other cases, though, would be an interesting topic for another discussion. Perhaps if I run across this issue again, I'll bring it up. Thanks for the input. :)
Got nasty VB.Net ListView flicker? Double Buffer it
This is my blog where I give my thoughts and opinions on various topics and share my creative endeavors with the world. I run two personal blogs, but combine them here for ease of access.
Blogger - My oldest blog using the Blogger platform contains posts full of opinions, gaming, and code.
Tumblr - Tumblr posts are all about my creative side, containing music, videos, writings, and updates on my web creations.
You can select a category below to view the latest post, or browse thorugh the posts using the navigation found at the top and bottom of each post.
In California, truck license plates are 7 characters, all numbers except for one letter in either the second or the sixth position. Whenever that letter is an X, I get nerd snipped into treating it as a multiplication problem and solving it in my head.
we should have paid more attention to the cats who, for decades, put their bodies on the line to walk on keyboards and sit on laptops and prevent us from programming
Former 2 time world champion DogPlayingTetris becomes the first player to ever rollover the level counter in NES Tetris, performing what's known in the community as "Rebirth". Final score: 29,486,164, 4216 lines, level 347 (256 + 91)... all huge world records. #tetris
I'd also love a 6 hour layover overnight instead of taking the red eye I was going to take and be 7 hours later getting into Cleveland than I wanted, why do you ask? #airporthell
Why yes, I'd love to leave at 4:40 to get to the airport at 6:20 for an 8:20 flight that got delayed to 9:05 which is too late for my connection so now I'm on a 10:20 flight instead. Why do you ask? #airporthell
@shanselman Who at Microsoft do I have to bribe to fix ADO so that those of us on dark mode who copy/paste text from one task to another can do so without our friends on light mode seeing dark text on a dark background?
I updated the blog post with a statement from Revival. While I'm not particularly happy with Revival's decision, I understand their motives. It's just a shame that it was someone from Interplay that had to go and do this. "By games for gamers" my ass.
Damn, got another Tetris world record! This time in the arcade variant developed by Atari. 6,008,005 points, 5,386 lines, round 363. Be warned, it's nearly FIVE HOURS. https://www.twitch.tv/videos/2131759212
1) Replace the inherits line, located directly under the Public Class line, with this:
Inherits System.Windows.Forms.ListView
2) At the end of Public Sub New, add this:
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.Opaque, True)
Don't forget to build your project before using.
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
All Flicker gone :)