Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9019229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:43:35+00:00 2026-06-16T04:43:35+00:00

I have 2 regions in a window, each with their own tooltip. these tooltips

  • 0

I have 2 regions in a window, each with their own tooltip.
these tooltips are custom drawn by handling the WM_PAINT message (to prevent flicker).

This is the creation of the tooltips:

tooltips[MAIN_GRAPH_TT].tthWnd =  CreateWindowEx(WS_EX_TOPMOST,TOOLTIPS_CLASS,0,WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP | TTS_NOFADE,CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,0,g_hInst,0);  
tooltips[SECONDARY_GRAPH_TT].tthWnd =   CreateWindowEx(WS_EX_TOPMOST,TOOLTIPS_CLASS,0,WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP | TTS_NOFADE,CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,0,g_hInst,0);  

This is initialisation of the tooltips:

if (tooltips[MAIN_GRAPH_TT].tthWnd)
{

    lpfnOldTTProc = (WNDPROC)SetWindowLong(tooltips[MAIN_GRAPH_TT].tthWnd,
        GWL_WNDPROC, (DWORD) TooltipProc);
    SetWindowLong(tooltips[MAIN_GRAPH_TT].tthWnd, GWL_EXSTYLE, WS_EX_LAYERED|WS_EX_TOOLWINDOW);
    SetLayeredWindowAttributes(tooltips[MAIN_GRAPH_TT].tthWnd,RGB(255,0,0),0,ULW_COLORKEY);
    SendMessage(tooltips[MAIN_GRAPH_TT].tthWnd,CWM_SETWNDPROC,0,(LPARAM)new WNDPROC(lpfnOldTTProc));
}

if (tooltips[SECONDARY_GRAPH_TT].tthWnd)
{

    lpfnOldTTProc = (WNDPROC)SetWindowLong(tooltips[SECONDARY_GRAPH_TT].tthWnd, GWL_WNDPROC, (DWORD) TooltipProc);
    SetWindowLong(tooltips[SECONDARY_GRAPH_TT].tthWnd, GWL_EXSTYLE, WS_EX_LAYERED|WS_EX_TOOLWINDOW);
    SetLayeredWindowAttributes(tooltips[SECONDARY_GRAPH_TT].tthWnd,RGB(255,0,0),0,ULW_COLORKEY);
    SendMessage(tooltips[SECONDARY_GRAPH_TT].tthWnd,CWM_SETWNDPROC,0,(LPARAM)new WNDPROC(lpfnOldTTProc));
}  

And this is the WM_PAINT of the custom tooltip WNDPROC:

 case WM_PAINT:
     {

        const int FRAME_WIDTH = 1;
        const int CORNER_DIAMETER = 10;
        PAINTSTRUCT ps;
        HDC hdc = BeginPaint(hWnd,&ps);
        HDC hMemDC;
        RECT cr;
        GetClientRect(hWnd,&cr);
        hMemDC = CreateCompatibleDC(hdc);
        HBITMAP memBM = CreateCompatibleBitmap(hdc, cr.right-cr.left, cr.bottom-cr.top);
        HBITMAP hOldBM = (HBITMAP) SelectObject(hMemDC,memBM);
        //drawing start [draw to hMemDC]
        {
            FillSolidRect(hMemDC,0,0,cr.right-cr.left,cr.bottom-cr.top,RGB(255,0,0));               
            HPEN hFramePen = CreatePen(PS_SOLID,FRAME_WIDTH,BLACK);
            HBRUSH hBGBrush = GetSysColorBrush(COLOR_INFOBK);
            SetTextColor(hMemDC,GetSysColor(COLOR_INFOTEXT));
            SetBkColor(hMemDC,WHITENESS);
            SetBkMode(hMemDC,TRANSPARENT);
            HBRUSH hOldBrush = (HBRUSH) SelectObject(hMemDC,hBGBrush);
            HPEN hOldPen = (HPEN) SelectObject(hMemDC,hFramePen);
            HFONT hOldFont = SelectFont(hMemDC,g_hFonts[FONT_TOOLTIP]);
            RoundRect(hMemDC,cr.left,cr.top,cr.right,cr.bottom,CORNER_DIAMETER,CORNER_DIAMETER);
            RECT textRec = cr;
            textRec.left += FRAME_WIDTH*2;
            textRec.right -= FRAME_WIDTH*2;
            textRec.top += FRAME_WIDTH*2;
            textRec.bottom -= FRAME_WIDTH*2;
            if(hWnd == tooltips[MAIN_GRAPH_TT].tthWnd)
                DrawText(hMemDC,tttBuffer[MAIN_GRAPH_TT],sizeof(tttBuffer),&textRec,DT_LEFT|DT_TOP);
            else if(hWnd == tooltips[SECONDARY_GRAPH_TT].tthWnd)
                DrawText(hMemDC,tttBuffer[SECONDARY_GRAPH_TT],sizeof(tttBuffer),&textRec,DT_LEFT|DT_TOP);
            SelectObject(hMemDC,hOldBrush);
            SelectObject(hMemDC,hOldPen);
            SelectObject(hMemDC,hOldFont);
            DeleteObject(hFramePen);
            DeleteObject(hBGBrush);

        }
        //drawing end
        BitBlt(hdc,
                cr.left,
                cr.top,
                cr.right-cr.left, cr.bottom-cr.top,
                hMemDC,
                0,
                0,
                SRCCOPY);
        SelectObject(hdc,hOldBM);
        DeleteObject(memBM);
        DeleteDC(hMemDC);
        EndPaint(hWnd,&ps);
     }
    break;

The problem with these tooltips is, the corners (outside of the round rect) are supposed to be transparent, but i cant seem to get them to dissapear.
I have tried (naívely) to use HOLLOW_BRUSH to paint the background rect, but didnt work, and as you can see from the example i’ve tried using the layered window approach, again to no avail.

Can anyone help me get transparency for the background of my tooltips?


Here is a picture of the tooltip without transparency
[the corners have been recoloured white for visibility — these are the parts that need to be transparent]
(Text blanked out)
Tooltip without transparency

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:43:37+00:00Added an answer on June 16, 2026 at 4:43 am

    You can use SetWindowRgn to make parts of a window transparent (create a region using CreateRoundRectRgn).

    Alternatively, you can use SetLayeredWindowAttributes to use true alpha blending to make parts of the window transparent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a project where remote users will have their own
I use regions with Prism. In the main window I have defined regions and
My company has a large customer that has many regions/sites/offices. Each location can have
In my Shell window I have a workspace region to allow view switching via
in .net you have Regions that you can collapse and remove lots of code
I have a working country map that with regions that animates fill on click
I have a map of the UK broken down into various geographic regions. I
Is there anyone who have encountered Processing Dirty Regions error in MyEclipse? Actually everytime
I have a few full screen png's where I want to create regions on
I have made a map with jQuery which is split up in many regions,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.