DataGridView flickers even when masked by transparent window
I have an issue with a DataGridView control. During开发者_如何学Python certain operations, the grid is covered by a semi-transparent dialog (to indicate to users of the operation and prevent users from pressing buttons, etc.). The grid updates at about 1Hz during this time. Under Windows XP, the DataGridView control occasionally "flickers" above the masking dialog for a second - not enough time to actually do anything, but a bit of an eyesore nonetheless. I've also noticed that on my development machine, which runs Window 7, the problem doesn't show up. I'm using .NET v3.5. Any help would be appreciated.
Win32 Form opacity isn't real opacity - but a copy of the images beneath it. This is the cause of the flicker and not something I have ever seen a way to work around.
Your Win7 issue is also having it - but since that machine and graphic card process much faster, you aren't actually seeing the redraw.
WPF uses true opacity and as such will not have this problem.
I had a strange flicker problem with Xp only (although that's where the similarities end). Give this a try in the form that's giving you the problem:
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or &H2000000
Return cp
End Get
End Property
精彩评论