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

  • Home
  • SEARCH
  • 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 8107239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:42:07+00:00 2026-06-06T00:42:07+00:00

How do I get a tooltip that is attached to the mouse cursor using

  • 0

How do I get a tooltip that is attached to the mouse cursor using C#? I’m trying to achieve an effect like the following, a small tooltip showing the status of Ctrl / Shift / Alt keys.

I’m currently using a Tooltip but it refuses to display unless it has about 2 lines of text.

tt = new ToolTip();
tt.AutomaticDelay = 0;
tt.ShowAlways = true;
tt.SetToolTip(this, " ");

In mouse move:

tt.ToolTipTitle = ".....";

tooltip

  • 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-06T00:42:08+00:00Added an answer on June 6, 2026 at 12:42 am

    So I don’t think there is any way you could do this purely with managed code. You would have to go native.

    The way I see it there are two options.

    1. P/Invoke the SendMessage function. Set the hwnd to your target window and pass in a TTM_ADDTOOL message and a TOOLINFO structure for the lParam. This is useful when you want a tooltip on an external window you haven’t created (one that isn’t in your app). You could get its hwnd by calling FindWindow.

      See how all this is done here in this article. You just have to add the P/Invoke.

    2. Apparently you can use the CreateWindowEx() function with TOOLTIPS_CLASS as a classname and it will generate a tooltip for you. Something like this:

      HWND hwndTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL,
                              WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
                              CW_USEDEFAULT, CW_USEDEFAULT,
                              CW_USEDEFAULT, CW_USEDEFAULT,
                              hwndParent, NULL, hinstMyDll,
                              NULL);
      
      SetWindowPos(hwndTip, HWND_TOPMOST,0, 0, 0, 0,
               SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
      

      See the whole article here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb760250(v=vs.85).aspx


    To get you upto speed, you would have something like this defined in you .NET code. I got the definition from here.

    You will find all the structures I’ve mentioned in my answer on the same website (or other similar ones) Once you have defined all of them in your code, you can then easily transpose/port the C samples that are in my answer and the linked articles.:

    class NativeFunctions 
    {
    [DllImport("user32.dll", SetLastError=true)]
    static extern IntPtr CreateWindowEx(
       WindowStylesEx dwExStyle, 
       string lpClassName,
       string lpWindowName, 
       WindowStyles dwStyle, 
       int x, 
       int y, 
       int nWidth, 
       int nHeight,
       IntPtr hWndParent, 
       IntPtr hMenu, 
       IntPtr hInstance, 
       IntPtr lpParam);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following ToolTip code works in WPF . I'm trying to get it to
I am using the jQuery Tools Tooltip (http://flowplayer.org/tools/tooltip/index.html), and I'm trying to get the
trying to get same string on tooltip as is in the Text e.g. Text=<%#
I am using this jQuery Tooltip plugin . I am trying to emulate the
This is what I'm trying to achieve I have a fluid tooltip and a
I have a tooltip background-image that looks like this: My css is like this:
I have a tooltip that is appearing on mouse hover on an image: ToolTip
I want to have a tooltip that shows different things when the mouse goes
I'm using QTCreator on the Mac, and I'm trying to get used to it.
I was wondering is it possible to customize the tooltip that we get after

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.