JiShirley-1989 avatar image
0 Votes"
JiShirley-1989 asked ·

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

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.
I add RelayEvent in PreTranslateMessage function.
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.

Could you help me find the reasion? Thanks a lot.

· 3
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Does the CTreeCtrl use onpaint to redraw? Or use onEraseBkGround to redraw?

And an internal WM_PAINT message is sent only once by Windows. After an internal WM_PAINT message is sent to a window by the UpdateWindow member function, no further WM_PAINT messages will be sent or posted until the window is invalidated or until the RedrawWindow member function is called again with the RDW_INTERNALPAINT flag set.

Could you please provide a code sample to help us reproduce the issue?

0 Votes 0 ·

Thanks Jeanine, yes I redraw OnPaint in CTreeCtrl.
As you mentioned, an internal WM_PAINT message is sent only once, but in my CMyTreeCtrl the functions in CMFCToolTipCtrl are also not work, for example TTN_POP and TTN_SHOW.

Besides, I use CMFCToolTipCtrl object and call invalidateRect or UpdateWindows, it also can't enter OnPaint.
may be I have something wrong in my code. I will make a simple code sample and attach later .

0 Votes 0 ·

I have solved this issue, I found out that it was because I used the callback mechanism to display ToolTip. If I use OnMouseMove to Update ToolTip Text and call RelayEvent, then ToolTip can enter onPaint and draw colors.

1 Vote 1 ·

0 Answers