+ Reply to Thread
Results 1 to 6 of 6

Screen flicker when changing Image.Picture source on UserForm

  1. #1
    Paul Martin
    Guest

    Screen flicker when changing Image.Picture source on UserForm

    Hi All

    On a UserForm, I have an Image control whose Picture property changes
    according to the user's selection. The image is a GIF copy of a
    chart. As the image loads, it flashes across the form, and turning
    off Application.ScreenUpdating has no effect. I have used Me.Repaint,
    to force the new image to appear (previously it wasn't). I would like
    the image to appear without the 'flash' or flicker, if possible.

    Any suggestions are appreciated.

    Paul Martin
    Melbourne, Australia

  2. #2
    Jim Cone
    Guest

    Re: Screen flicker when changing Image.Picture source on UserForm

    Hi Paul,

    Try adding an identical image control directly on top of the
    existing control.
    Then in your code, load the hidden control with the new image,
    followed by making the top control not visible and the bottom one
    visible.
    I've done something similar with text boxes on a form, using the mouse
    move event and the results are impressive.

    Regards,
    Jim Cone
    San Francisco, USA


    "Paul Martin" <pmartin1960@hotmail.com> wrote in message
    news:324f58a4.0504211326.21d88b5b@posting.google.com...
    > Hi All
    > On a UserForm, I have an Image control whose Picture property changes
    > according to the user's selection. The image is a GIF copy of a
    > chart. As the image loads, it flashes across the form, and turning
    > off Application.ScreenUpdating has no effect. I have used Me.Repaint,
    > to force the new image to appear (previously it wasn't). I would like
    > the image to appear without the 'flash' or flicker, if possible.
    > Any suggestions are appreciated.
    > Paul Martin
    > Melbourne, Australia


  3. #3
    keepITcool
    Guest

    Re: Screen flicker when changing Image.Picture source on UserForm


    application.screenupdating wonly affects excel's windows.
    try lockwindowupdate api

    as in:
    Option Explicit
    Private Declare Function FindWindow Lib "user32.dll" Alias _
    "FindWindowA" (ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
    Private Declare Function LockWindowUpdate Lib "user32.dll" ( _
    ByVal hwndLock As Long) As Long

    Dim b As Boolean

    Property Get hwnd() As Long
    Static h&
    If h = 0 Then
    h = FindWindow(IIf(Val(Application.Version) < 9, _
    "ThunderXFrame", "ThunderDFrame"), Me.Caption)
    End If
    hwnd = h
    End Property

    Private Sub UserForm_Click()
    LockWindowUpdate Me.hwnd
    If b Then
    Me.Image1.Picture = LoadPicture("c:\img1.jpg")
    Else
    Me.Image1.Picture = LoadPicture("c:\img2.jpg")
    End If
    b = Not b
    LockWindowUpdate 0&
    End Sub




    --
    keepITcool
    | www.XLsupport.com | keepITcool chello nl | amsterdam


    Paul Martin wrote :

    > Hi All
    >
    > On a UserForm, I have an Image control whose Picture property changes
    > according to the user's selection. The image is a GIF copy of a
    > chart. As the image loads, it flashes across the form, and turning
    > off Application.ScreenUpdating has no effect. I have used Me.Repaint,
    > to force the new image to appear (previously it wasn't). I would like
    > the image to appear without the 'flash' or flicker, if possible.
    >
    > Any suggestions are appreciated.
    >
    > Paul Martin
    > Melbourne, Australia


  4. #4
    Registered User Ivan F Moala's Avatar
    Join Date
    10-25-2003
    Location
    Auckland, New Zealand
    Posts
    71
    You could also try increasing the Userforms Drawbuffer .... try doubling it.

  5. #5
    Jim at Eagle
    Guest

    Re: Screen flicker when changing Image.Picture source on UserForm

    how many layers can you use? This sounds like a lot of fun if fade in and out
    by several layers.

    "Jim Cone" wrote:

    > Hi Paul,
    >
    > Try adding an identical image control directly on top of the
    > existing control.
    > Then in your code, load the hidden control with the new image,
    > followed by making the top control not visible and the bottom one
    > visible.
    > I've done something similar with text boxes on a form, using the mouse
    > move event and the results are impressive.
    >
    > Regards,
    > Jim Cone
    > San Francisco, USA
    >
    >
    > "Paul Martin" <pmartin1960@hotmail.com> wrote in message
    > news:324f58a4.0504211326.21d88b5b@posting.google.com...
    > > Hi All
    > > On a UserForm, I have an Image control whose Picture property changes
    > > according to the user's selection. The image is a GIF copy of a
    > > chart. As the image loads, it flashes across the form, and turning
    > > off Application.ScreenUpdating has no effect. I have used Me.Repaint,
    > > to force the new image to appear (previously it wasn't). I would like
    > > the image to appear without the 'flash' or flicker, if possible.
    > > Any suggestions are appreciated.
    > > Paul Martin
    > > Melbourne, Australia

    >


  6. #6
    Jim Cone
    Guest

    Re: Screen flicker when changing Image.Picture source on UserForm

    Only two controls are used.
    The new image goes in the one that is not visible, then the visible
    property of both is switched.

    Jim Cone
    San Francisco, USA


    "Jim at Eagle" <JimatEagle@discussions.microsoft.com> wrote in message
    news:99D013FC-A18B-4780-ACAA-611AED0A774E@microsoft.com...
    > how many layers can you use? This sounds like a lot of fun if fade in and out
    > by several layers.


    >
    > "Jim Cone" wrote:
    >
    > > Hi Paul,
    > > Try adding an identical image control directly on top of the
    > > existing control.
    > > Then in your code, load the hidden control with the new image,
    > > followed by making the top control not visible and the bottom one
    > > visible.
    > > I've done something similar with text boxes on a form, using the mouse
    > > move event and the results are impressive.
    > > Regards,
    > > Jim Cone
    > > San Francisco, USA



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1