Re: I cannot stop LV flickering when form resizing

Tech-Archive recommends: Fix windows errors by optimizing your registry




"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





.



Relevant Pages

  • Re: Trigger event on change to unbound text in unbound form progra
    ... Thanks Brendan. ... > change the value of that control programmatically, if that is what you mean. ... >> data from another form to trigger an action. ... >> date is shown in the calendar. ...
    (microsoft.public.access.forms)
  • Re: Row-Level Pseudo -Security
    ... control, ... This isn't something that SQL2K ... > to be able to update a certain table you give Joe the proper rights and he ... >> That's why I thought a trigger could verify the userid and allow ...
    (microsoft.public.sqlserver.programming)
  • Re: ComboBox Goes Blank When Forms AfterUpdate Code Runs
    ... off of a much less complex query that is built programatically and placed ... Typing a cost in the field does not trigger the field's On Change, ... Private Sub Form_BeforeInsert ...
    (microsoft.public.access.forms)
  • Re: How can I group and display columns automatically?
    ... visible, maybe one of your data columns, maybe a new column solely to ... Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, ... You may not want to use the before double-click code to trigger it, ... You can display ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Universal GotFocus() event?
    ... You haven't indicated what you want the 'trigger' to do. ... You wouldn't need to visit each control sequentially to do this. ... The form is unbound because I use code to ... > is unbound, the Form_Dirty, AfterUpdate, BeforeUpdate(), ...
    (microsoft.public.access.formscoding)