Solved

Problem msflexgrid flickering

Posted on 2013-12-23
3
423 Views
Last Modified: 2013-12-24
I am trying to update a 8 row 10 column msflexgrid, but cannot stop the flicker in the cells
setting the autodraw to false then true helps, but does not stop it completely.
How can this be fixed ?
the code
 Sub ResetBoard() 'reset all the cells back to form load(imgCellBG.Picture)
 Dim r As Integer
    Dim c As Integer
    flexCleo.Redraw = False
    DoEvents
    For c = 0 To 9
    For r = 0 To 7
    With flexCleo
    .Col = c
    .Row = r
   
      .CellForeColor = vbWhite '.CellPicture = imgHitUnSelected.Picture
    Set .CellPicture = imgCellBG.Picture
     
    End With
    Next
    Next
    flexCleo.Redraw = True
 End Sub

Open in new window

0
Comment
Question by:isnoend2001
  • 2
3 Comments
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 39738340
Try this. Add the following API declaration at the top of your form

Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long

Open in new window


And then try this
Sub ResetBoard() 'reset all the cells back to form load(imgCellBG.Picture)
 Dim r As Integer
    Dim c As Integer
    'flexCleo.Redraw = False
    LockWindowUpdate flexCleo.hWnd
    DoEvents
    For c = 0 To 9
    For r = 0 To 7
    With flexCleo
    .Col = c
    .Row = r
   
      .CellForeColor = vbWhite '.CellPicture = imgHitUnSelected.Picture
    Set .CellPicture = imgCellBG.Picture
     
    End With
    Next
    Next
    'flexCleo.Redraw = True
    LockWindowUpdate False
 End Sub

Open in new window

0
 

Author Closing Comment

by:isnoend2001
ID: 39738362
Good job
Thanks MartinLiss
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 39738371
You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2013
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now