Re: I cannot stop LV flickering when form resizing
- From: "Larry Serflaten" <serflaten@xxxxxxxxxxxxxx>
- Date: Sun, 6 Jan 2008 05:12:46 -0600
"Jack" <replyto@it> wrote
It does not matter what I do, the Listview object (filling up the form)
flickers, when the form is resized.
You might not like to hear it, but that is probably by design. Meaning,
the designers of the control did not feel a little flicker was going to hurt
anyone. For a 'real world' example, open the VB Object Browser and
resize that window....
If it was easy to get rid of, you would think MS would have eliminated
it in the Object Browser (or maybe not...) The flicker you see is just
inherent in the control.
The old kludge for a busy form was to use a timer to provide a delay
from the time the user starts resizing, to the time the controls get updated.
You can check it out by adding a timer to your example form (posted
elsewhere in the thread) and replace all your form code with the code
below....
Its a trade off, either you accept the flicker and see the control resize
with the form, or the control freezes momentarily, until the resizing
stops. I'd guess (for a simple solution) we have to pick our poison
on this one.
About the only way I could see to 'remove' the flicker is to keep a
persistant (full screen) image of the listview that can be placed in a
picturebox and brought to the top of the zorder when the user starts
resizing. But, as is common with 'detailed' work, that may be more
effort than its worth. What can be done easily is to use a picturebox
as a sort of curtain to hide the update. For an example add a picturebox
to the form (that has the timer) and use these events...
' -- Picture box curtain --
Private Sub Form_Resize()
Picture1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
Picture1.Visible = True
Picture1.ZOrder
trigger = trigger + 1
If Not Timer1.Enabled Then Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If trigger > 0 Then
trigger = trigger \ 2
Else
Frame1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
ListView1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
Timer1.Enabled = False
Picture1.Visible = False
End If
End Sub
' -- --
Try them out and see if you really want to spend more time nit-picking
at the details! ;-)
LFS
' -- Old timer kludge --
Option Explicit
Private trigger As Long
Private Sub Form_Load()
Me.ScaleMode = vbTwips
ListView1.View = lvwReport
ListView1.ListItems.Add , , "Bob Butler"
ListView1.ListItems.Add , , "Stefan Berglund"
ListView1.ListItems.Add , , "Mike D???"
ListView1.ListItems.Add , , "Steve Easton"
ListView1.ListItems.Add , , "Steve Gerrard"
ListView1.ListItems.Add , , "Ken Halter"
ListView1.ListItems.Add , , "Robert Morley"
ListView1.ListItems.Add , , "Karl E. Peterson"
ListView1.ListItems.Add , , "Kevin Provance"
ListView1.ListItems.Add , , "Rick Rothstein"
ListView1.ListItems.Add , , "Larry Serflaten"
ListView1.ListItems.Add , , "Galen Somerville"
ListView1.ListItems.Add , , "Mike Williams"
Timer1.Interval = 60
Timer1_Timer
End Sub
Private Sub Form_Resize()
trigger = trigger + 1
If Not Timer1.Enabled Then Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If trigger > 0 Then
trigger = trigger \ 2
Else
Frame1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
ListView1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
Timer1.Enabled = False
End If
End Sub
.
- Follow-Ups:
- Re: I cannot stop LV flickering when form resizing
- From: Mike Williams
- Re: I cannot stop LV flickering when form resizing
- References:
- Prev by Date: IDTExtensibility on Vista event firing problem
- Next by Date: Re: Still BitBlit/ GDI question...
- Previous by thread: Re: I cannot stop LV flickering when form resizing
- Next by thread: Re: I cannot stop LV flickering when form resizing
- Index(es):
Relevant Pages
|