MarkD
  • MarkD
  • Newbie Topic Starter
2025-07-23T19:21:06Z
Hi, Igor,

when custom drawing cells everything looks fine at a first glance.
But the drawings dissappear when I open a message box and reappear when the MsgBox is closed.
This is problematic if the message box contains text regarding the custom drawings.

I built a small sample database to demonstrate the behaviour (tested with .1058).

Thanks for any help - Mark

  iGridTestCustomDraw.zip (30kb) downloaded 85 time(s).
Igor/10Tec
2025-07-24T15:08:25Z
As I understand, this effect is related to the specific processing of paint messages in Access. Most likely, we can do nothing with that.
MarkD
  • MarkD
  • Newbie Topic Starter
2025-07-24T18:40:44Z
what a pity, but thanks for your answer.

I have this problem also when opening another form.

My current workaround is exposing this function in the form with the grid


Public Declare PtrSafe Function InvalidateRect Lib "user32" (ByVal hWnd As LongPtr, ByVal lpRect As LongPtr, ByVal bErase As Long) As Long

Public Sub ReDrawGrid()
  Dim hWndGrid As LongPtr
  hWndGrid = MyGrid.hWnd
  Call InvalidateRect(hWndGrid, 0, 1)
End Sub

and calling the function from the other form. A bit flickering, not nice, but works.

Igor/10Tec
2025-07-25T14:23:20Z
I think the problem is related to the system message box dialog that is modal and lock control updates somehow.

Interesting, how do you use your workaround if the message box is modal and should stop any code execution while it is open?