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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. hey, how can i retrive a letter from a controll under the cursor??

hey, how can i retrive a letter from a controll under the cursor??

Scheduled Pinned Locked Moved C#
questionhelp
3 Posts 2 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.
  • N Offline
    N Offline
    NZSmartie
    wrote on last edited by
    #1

    hey, I'm havening trouble trying to get the letter under the mouse my purpose is to make each letter in a label select able or a button. can any one help, i would be great if you do ;) Thanks

    C 1 Reply Last reply
    0
    • N NZSmartie

      hey, I'm havening trouble trying to get the letter under the mouse my purpose is to make each letter in a label select able or a button. can any one help, i would be great if you do ;) Thanks

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

      There's a Win32 API called WindowFromPoint, this will give you the window handle of the control you are over. From there, you can use GetWindowText, but working out what letter is under the mouse, will be a little more complex, you need to get the font details from the control, and work out how that font renders. A multi line control makes it even harder. I imagine getting it to work 100% of the time would be a very big job, indeed.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      N 1 Reply Last reply
      0
      • C Christian Graus

        There's a Win32 API called WindowFromPoint, this will give you the window handle of the control you are over. From there, you can use GetWindowText, but working out what letter is under the mouse, will be a little more complex, you need to get the font details from the control, and work out how that font renders. A multi line control makes it even harder. I imagine getting it to work 100% of the time would be a very big job, indeed.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        N Offline
        N Offline
        NZSmartie
        wrote on last edited by
        #3

        yea it would be, i'll look into that and see how i go, my font is 'Lucida Console, 9pt' which makes each letter the same width part. thanks for that :rolleyes::-D

        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