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#
  4. Get current cursor lower left position so that tooltip could be displayed properly

Get current cursor lower left position so that tooltip could be displayed properly

Scheduled Pinned Locked Moved C#
question
4 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.
  • L Offline
    L Offline
    LiYS
    wrote on last edited by
    #1

    Hi all, I'm trying to display the tooltip by calling "ToolTip.Show(String, IWin32Window, Point)", but I wanted to do it like what Windows explorer does - displays the tooltip at the lower left corner of the cursor. I could get the mouse position by "MousePosition", but how could I get its lower left corner position? Thanks,


    C L L 3 Replies Last reply
    0
    • L LiYS

      Hi all, I'm trying to display the tooltip by calling "ToolTip.Show(String, IWin32Window, Point)", but I wanted to do it like what Windows explorer does - displays the tooltip at the lower left corner of the cursor. I could get the mouse position by "MousePosition", but how could I get its lower left corner position? Thanks,


      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You'd have to get the current cursor icon and work out where inside it is the point that corresponds to the mouse 'position'.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • L LiYS

        Hi all, I'm trying to display the tooltip by calling "ToolTip.Show(String, IWin32Window, Point)", but I wanted to do it like what Windows explorer does - displays the tooltip at the lower left corner of the cursor. I could get the mouse position by "MousePosition", but how could I get its lower left corner position? Thanks,


        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        Hi, Most cursors have a size of (32,32); there is SystemInformation.CursorSize, but AFAIK that is a constant, it does not depend on current cursor, and active window. So the easiest thing to do would be to adjust MousePosition by (0,32). BTW: most cursors have their hotspot at (0,0); when this changes, you might want to take that in account too... :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


        1 Reply Last reply
        0
        • L LiYS

          Hi all, I'm trying to display the tooltip by calling "ToolTip.Show(String, IWin32Window, Point)", but I wanted to do it like what Windows explorer does - displays the tooltip at the lower left corner of the cursor. I could get the mouse position by "MousePosition", but how could I get its lower left corner position? Thanks,


          L Offline
          L Offline
          LiYS
          wrote on last edited by
          #4

          Thanks for the replies. It seemed “Cursor.Size.Height” could be used。


          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