Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Thanked 0 Times in 0 Posts

    Re-paint bad painted control (1.0)

    Hi everyone,

    I have a control that is poorly painted by Excel. In a sheet I have approx. 10 diff. controls and among them 2 DatePicker's and 2 DTPicker's. All of them are painted wrong the first time I see them (in "release" mode / non 'design mode'). I don't understand why that is. I fix it by scrolling 1 and then -1 leaving the sheet in its orig. pos. I dont have any Repaint(...) or Invalidate(..) or do I?

    Ps. Perhaps it is due to a malfunctioning screen driver or something.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: Re-paint bad painted control (1.0)

    This solution was posted by Michael as a separate thread. To make it easier to find, reposted here by HansV

    <img src=/w3timages/blueline.gif width=33% height=2>

    Some days ago I posted one about bad painted DTPickers. I could see in the archive that back in 2002 another member has exactly that problem also. However nobody seemed to find any solution back the - BUT (here it comes) <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    I did this:

    ' Declare VBA SendMessage(...) as delegate to user32 version in c.
    Public Declare Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

    ' In my VBA:
    Dim lResult As Long
    ' #define WM_PAINT 0x000F ' From winuser.h
    Dim WM_PAINT As Integer
    WM_PAINT = &HF&
    lResult = SendMessage(ShtPublication_Periodic.dtpPublishingT ime.hwnd, WM_PAINT, 0, 0)

    IT WORKED!!! Yahhhh *SSS*


Posting Permissions

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