Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CMFCToolTipCtrl doen't enter OnPaint when I use it in my self-draw CTreeCtrl

CMFCToolTipCtrl doen't enter OnPaint when I use it in my self-draw CTreeCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
comadobedebugginghelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 14882671
    wrote on last edited by
    #1

    Non-modal ActiveX Control, a self-draw CMyTreeCtrl is shown on it. Now, I create a CMFCToolTipCtrl in my CMyTreeCtrl and I want to dynamically change the text color of Tooltip. I use SetParams in the ToolTip callback function and set new color/text . However, I can't get new color when the tooltip displayed. After I debug and found that it can't enter CMFCToolTipCtrl onPaint. If I use invalidate, then the whole ActiveX Control will flash rapidly. I inherited CMFCToolTipCtrl and found that WM_PAINT cannot be received in PreTranslateMessage. It can only receive WM_TIMER. Any other functions in afxtooltipctrl.h are not entered when the tooltip is shown. And CMyTreeCtrl can receive WM_PAINT. Could you help me find the reasion? Thanks a lot.

    L V 2 Replies Last reply
    0
    • M Member 14882671

      Non-modal ActiveX Control, a self-draw CMyTreeCtrl is shown on it. Now, I create a CMFCToolTipCtrl in my CMyTreeCtrl and I want to dynamically change the text color of Tooltip. I use SetParams in the ToolTip callback function and set new color/text . However, I can't get new color when the tooltip displayed. After I debug and found that it can't enter CMFCToolTipCtrl onPaint. If I use invalidate, then the whole ActiveX Control will flash rapidly. I inherited CMFCToolTipCtrl and found that WM_PAINT cannot be received in PreTranslateMessage. It can only receive WM_TIMER. Any other functions in afxtooltipctrl.h are not entered when the tooltip is shown. And CMyTreeCtrl can receive WM_PAINT. Could you help me find the reasion? Thanks a lot.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Hi, Are you creating the CMFCToolTipCtrl with the TTF_SUBCLASS flag[^]? If so then you should be able to capture the NM_CUSTOMDRAW message[^] and check for the CDDS_PREPAINT draw stage. You can use SetTextColor[^] to change the text color from there. Best Wishes, -David Delaune

      1 Reply Last reply
      0
      • M Member 14882671

        Non-modal ActiveX Control, a self-draw CMyTreeCtrl is shown on it. Now, I create a CMFCToolTipCtrl in my CMyTreeCtrl and I want to dynamically change the text color of Tooltip. I use SetParams in the ToolTip callback function and set new color/text . However, I can't get new color when the tooltip displayed. After I debug and found that it can't enter CMFCToolTipCtrl onPaint. If I use invalidate, then the whole ActiveX Control will flash rapidly. I inherited CMFCToolTipCtrl and found that WM_PAINT cannot be received in PreTranslateMessage. It can only receive WM_TIMER. Any other functions in afxtooltipctrl.h are not entered when the tooltip is shown. And CMyTreeCtrl can receive WM_PAINT. Could you help me find the reasion? Thanks a lot.

        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #3

        Member 14882671 wrote:

        I use SetParams in the ToolTip callback function and set new color/text . However, I can't get new color when the tooltip displayed. After I debug and found that it can't enter CMFCToolTipCtrl onPaint. If I use invalidate, then the whole ActiveX Control will flash rapidly. I inherited CMFCToolTipCtrl and found that WM_PAINT cannot be received

        There are virtual methods you could use to customize CMFCToolTipCtrl: [CMFCToolTipCtrl Class | Microsoft Docs](https://docs.microsoft.com/en-us/cpp/mfc/reference/cmfctooltipctrl-class?view=msvc-160#onfillbackground) and some other OnDraw... methods.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups