Access VBA Flicker 
Author Message
 Access VBA Flicker

Hello,

I have inherited an Access 2000 application that has many [~15] subforms on
a main form. These forms have a label whose caption is updated with the
current display value. The sub forms also have a Line which is moved to
display the value graphically, like an analog gauge. These sub forms have an
Image control containing a bitmap of the gauge

The problem is if the update is done more quickly than ~250ms, the labels
and the lines flicker, showing the underlying screen color, even through the
Image control. It makes little difference if only the changes are written to
the 'controls'

I tried some OCX controls, but the 'pointer' is drawn and the 'dial' is not
until the form is refreshed by choosing another application and then coming
back to Access. The same controls, using the same update code show no
problems in VB6. No response yet from control vendors.

I tried using an image control and moving a new image to the image control
on the subforms, but moving the .PictureData is abysmally slow. Changing the
.PictureData minimum change is about 100ms, judged by the update of the
forms on the screen. I tested changing the .Picture property and can change
the .Picture very rapidly, perhaps less than 5ms. I expected the
.PictureData to be much faster.

The DoEvents have no effect.
Private Sub Form_Timer()
    Static lngDir As Long

    lngDir = lngDir Xor True

    If lngDir Then
        Forms("zzzfrmG2Test").Controls("imgBMP").Picture =
Forms("zzzfrmG0Test").Controls("imgBMP").Picture
DoEvents
        Forms("zzzfrmG0Test").Controls("imgBMP").Picture =
Forms("zzzfrmG1Test").Controls("imgBMP").Picture
DoEvents
        Forms("zzzfrmG1Test").Controls("imgBMP").Picture =
Forms("zzzfrmG2Test").Controls("imgBMP").Picture
DoEvents
    Else
        Forms("zzzfrmG2Test").Controls("imgBMP").Picture =
Forms("zzzfrmG1Test").Controls("imgBMP").Picture
DoEvents
        Forms("zzzfrmG1Test").Controls("imgBMP").Picture =
Forms("zzzfrmG0Test").Controls("imgBMP").Picture
DoEvents
        Forms("zzzfrmG0Test").Controls("imgBMP").Picture =
Forms("zzzfrmG2Test").Controls("imgBMP").Picture
DoEvents
    End If

    SysCmd acSysCmdSetStatus, Me.TimerInterval
DoEvents
End Sub

The timing issue does not appear to be related to the graphics card. I tried
the application on 2 machines : 1 with a 32MB SIS 305 video and another with
an old Trident 9750. Both machines running Win2k 1.8GHz 512MB and 2GHz
256MB. The only change that had any effect at reducing the artifact is
setting the ColorDepth in the Display Properties to 32Bit.

Any help will be most appreciated.



Wed, 23 Mar 2005 00:21:12 GMT  
 Access VBA Flicker

Quote:
> I have inherited an Access 2000 application that has many [~15] subforms
on
> a main form. These forms have a label whose caption is updated with the
> current display value. The sub forms also have a Line which is moved to
> display the value graphically, like an analog gauge. These sub forms have
an
> Image control containing a bitmap of the gauge

> The problem is if the update is done more quickly than ~250ms, the labels
> and the lines flicker, showing the underlying screen color, even through
the
> Image control. It makes little difference if only the changes are written
to
> the 'controls'

> I tried some OCX controls, but the 'pointer' is drawn and the 'dial' is
not
> until the form is refreshed by choosing another application and then
coming
> back to Access. The same controls, using the same update code show no
> problems in VB6. No response yet from control vendors.

> I tried using an image control and moving a new image to the image control
> on the subforms, but moving the .PictureData is abysmally slow. Changing
the
> .PictureData minimum change is about 100ms, judged by the update of the
> forms on the screen. I tested changing the .Picture property and can
change
> the .Picture very rapidly, perhaps less than 5ms. I expected the
> .PictureData to be much faster.

The problem here is that the Label, Line and Image controls (Among others)
are what's known as 'Windowless' controls (Well, technically everything is
in Access, but that's another story..) and as such they don't exist at
runtime - They're drawn over the background when it updates which sounds
fine but first the background is drawn, then each of the subsequent controls
are drawn on top if that directly to screen.  This leads to the undesired
flickering since the screen is updating faster than the drawing is and you
see the in-between stages, you will get the same problems in VB too although
not quite so badly.
Unfortunately in Access you get very little access (No pun intended ;) to
what's actually going on behind the scenes visually as most of it's hidden
from you.  What I've done in the past for our Access developers it to write
these visual components in VB where you get full control over the drawing,
then compile it to an ActiveX OCX which can be embedded on an Access form.
Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Wed, 23 Mar 2005 01:20:27 GMT  
 Access VBA Flicker



Quote:
> > I have inherited an Access 2000 application that has many [~15] subforms
> on
> > a main form. These forms have a label whose caption is updated with the
> > current display value. The sub forms also have a Line which is moved to
> > display the value graphically, like an analog gauge. These sub forms
have
> an
> > Image control containing a bitmap of the gauge

> > The problem is if the update is done more quickly than ~250ms, the
labels
> > and the lines flicker, showing the underlying screen color, even through
> the
> > Image control. It makes little difference if only the changes are
written
> to
> > the 'controls'

> > I tried some OCX controls, but the 'pointer' is drawn and the 'dial' is
> not
> > until the form is refreshed by choosing another application and then
> coming
> > back to Access. The same controls, using the same update code show no
> > problems in VB6. No response yet from control vendors.

> > I tried using an image control and moving a new image to the image
control
> > on the subforms, but moving the .PictureData is abysmally slow. Changing
> the
> > .PictureData minimum change is about 100ms, judged by the update of the
> > forms on the screen. I tested changing the .Picture property and can
> change
> > the .Picture very rapidly, perhaps less than 5ms. I expected the
> > .PictureData to be much faster.

> The problem here is that the Label, Line and Image controls (Among others)
> are what's known as 'Windowless' controls (Well, technically everything is
> in Access, but that's another story..) and as such they don't exist at
> runtime - They're drawn over the background when it updates which sounds
> fine but first the background is drawn, then each of the subsequent
controls
> are drawn on top if that directly to screen.  This leads to the undesired
> flickering since the screen is updating faster than the drawing is and you
> see the in-between stages, you will get the same problems in VB too
although
> not quite so badly.
> Unfortunately in Access you get very little access (No pun intended ;) to
> what's actually going on behind the scenes visually as most of it's hidden
> from you.  What I've done in the past for our Access developers it to
write
> these visual components in VB where you get full control over the drawing,
> then compile it to an ActiveX OCX which can be embedded on an Access form.
> Hope this helps,

>     Mike

>  -- EDais --

>  - Microsoft Visual Basic MVP -
> WWW: Http://EDais.earlsoft.co.uk/



I think I may have some additional information. If I have the subforms open
as forms and write to the labels and , I can make the lines and labels
update without any artifacts at all. I can make the lines look like
windshield wipers on Hi. Could this have anything to do with the 'control'
being on a sub form and the form below is showing through.

TIA



Wed, 23 Mar 2005 03:01:15 GMT  
 Access VBA Flicker

Quote:
> I think I may have some additional information. If I have the subforms
open
> as forms and write to the labels and , I can make the lines and labels
> update without any artifacts at all. I can make the lines look like
> windshield wipers on Hi. Could this have anything to do with the 'control'
> being on a sub form and the form below is showing through.

From what I understand, only the top-most window in Access is actually a
true window, the rest are just images drawn on the main Access window.
Controls created in VB will have their own window though that you can
repaint if and when you wish.
Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Wed, 23 Mar 2005 03:26:29 GMT  
 Access VBA Flicker



Quote:
> > I think I may have some additional information. If I have the subforms
> open
> > as forms and write to the labels and , I can make the lines and labels
> > update without any artifacts at all. I can make the lines look like
> > windshield wipers on Hi. Could this have anything to do with the
'control'
> > being on a sub form and the form below is showing through.

> From what I understand, only the top-most window in Access is actually a
> true window, the rest are just images drawn on the main Access window.
> Controls created in VB will have their own window though that you can
> repaint if and when you wish.
> Hope this helps,

>     Mike

>  -- EDais --

>  - Microsoft Visual Basic MVP -
> WWW: Http://EDais.earlsoft.co.uk/



When you say top most, do you mean the application or the top most form?


Wed, 23 Mar 2005 07:33:56 GMT  
 Access VBA Flicker

Quote:
> When you say top most, do you mean the application or the top most form?

The top most form, most other windows will have their own window objects.

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Wed, 23 Mar 2005 07:38:25 GMT  
 Access VBA Flicker
I wrote a class to encapsulate the standard Access Image control
extending it to resemble the basic functionality of the VB PictureBox
control. Perhaps you could give it a try and eliminate the Line
controls.
http://www.lebans.com/imageclass.htm

Manipulating the PictureData prop is inherently much faster than loading
a new Image via the Picture prop. WIthout seeing your code I'm not sure
why your testing results do not support this.

I think you are running into Form/SubForm repainting issues when you
manipulate the Line controls.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.



Quote:
> Hello,

> I have inherited an Access 2000 application that has many [~15]
subforms on
> a main form. These forms have a label whose caption is updated with
the
> current display value. The sub forms also have a Line which is moved
to
> display the value graphically, like an analog gauge. These sub forms
have an
> Image control containing a bitmap of the gauge

> The problem is if the update is done more quickly than ~250ms, the
labels
> and the lines flicker, showing the underlying screen color, even
through the
> Image control. It makes little difference if only the changes are
written to
> the 'controls'

> I tried some OCX controls, but the 'pointer' is drawn and the 'dial'
is not
> until the form is refreshed by choosing another application and then
coming
> back to Access. The same controls, using the same update code show no
> problems in VB6. No response yet from control vendors.

> I tried using an image control and moving a new image to the image
control
> on the subforms, but moving the .PictureData is abysmally slow.
Changing the
> .PictureData minimum change is about 100ms, judged by the update of
the
> forms on the screen. I tested changing the .Picture property and can
change
> the .Picture very rapidly, perhaps less than 5ms. I expected the
> .PictureData to be much faster.

> The DoEvents have no effect.
> Private Sub Form_Timer()
>     Static lngDir As Long

>     lngDir = lngDir Xor True

>     If lngDir Then
>         Forms("zzzfrmG2Test").Controls("imgBMP").Picture =
> Forms("zzzfrmG0Test").Controls("imgBMP").Picture
> DoEvents
>         Forms("zzzfrmG0Test").Controls("imgBMP").Picture =
> Forms("zzzfrmG1Test").Controls("imgBMP").Picture
> DoEvents
>         Forms("zzzfrmG1Test").Controls("imgBMP").Picture =
> Forms("zzzfrmG2Test").Controls("imgBMP").Picture
> DoEvents
>     Else
>         Forms("zzzfrmG2Test").Controls("imgBMP").Picture =
> Forms("zzzfrmG1Test").Controls("imgBMP").Picture
> DoEvents
>         Forms("zzzfrmG1Test").Controls("imgBMP").Picture =
> Forms("zzzfrmG0Test").Controls("imgBMP").Picture
> DoEvents
>         Forms("zzzfrmG0Test").Controls("imgBMP").Picture =
> Forms("zzzfrmG2Test").Controls("imgBMP").Picture
> DoEvents
>     End If

>     SysCmd acSysCmdSetStatus, Me.TimerInterval
> DoEvents
> End Sub

> The timing issue does not appear to be related to the graphics card. I
tried
> the application on 2 machines : 1 with a 32MB SIS 305 video and
another with
> an old Trident 9750. Both machines running Win2k 1.8GHz 512MB and 2GHz
> 256MB. The only change that had any effect at reducing the artifact is
> setting the ColorDepth in the Display Properties to 32Bit.

> Any help will be most appreciated.



Wed, 23 Mar 2005 12:06:43 GMT  
 Access VBA Flicker

Quote:
>The problem is if the update is done more quickly than ~250ms, the labels
>and the lines flicker, showing the underlying screen color, even through the
>Image control. It makes little difference if only the changes are written to
>the 'controls'

I'm not at all sure this is applicable in your situation but what
about Echo Method?

Tony
--
Tony Toews, Microsoft Access MVP
   Please respond only in the newsgroups so that others can
read the entire thread of messages.
   Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm



Thu, 24 Mar 2005 07:42:28 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Access 97 VBA v Access 2K VBA - different ?

2. Access 2000 VBA Handbook vis a vis Access 97 VBA Handbook

3. vbHourglass flickers during data access

4. Access VBA Calling MSWord/Excel VBA?

5. VBA Analysis Tookpack- Excel In Access VBA

6. ACCESS VBA - why different from other vba?

7. vba access vs vba excel (alguien sabe?)

8. Is Access VBA as fast as VB VBA?

9. How to access Office VBA from Outlook VBA

10. Exec. Word VBA Function From Access using VBA

11. export from Access to Access using VBA

12. Access 2000 VBA code not working Access 2002

 

 
Powered by phpBB® Forum Software