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. captuting mouse position.

captuting mouse position.

Scheduled Pinned Locked Moved C#
csharp
3 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.
  • U Offline
    U Offline
    User 1384494
    wrote on last edited by
    #1

    hai all :-O, i am creating a c# application where i have a panel and on top of that i have an user control. when i click the usercontrol at any position, i need to capture the exact mouse position on the panel. Sweta

    J S 2 Replies Last reply
    0
    • U User 1384494

      hai all :-O, i am creating a c# application where i have a panel and on top of that i have an user control. when i click the usercontrol at any position, i need to capture the exact mouse position on the panel. Sweta

      J Offline
      J Offline
      Jon G
      wrote on last edited by
      #2

      in your OnMouseUp event of your control, add the following code: MessageBox.Show("X: " + Cursor.Position.X + ", Y: " + Cursor.Position.Y); You can use the Cursor.Position property to find the current location of your mouse cursor on the screen. Jon G www.Gizmocoder.com

      1 Reply Last reply
      0
      • U User 1384494

        hai all :-O, i am creating a c# application where i have a panel and on top of that i have an user control. when i click the usercontrol at any position, i need to capture the exact mouse position on the panel. Sweta

        S Offline
        S Offline
        Stefan Troschuetz
        wrote on last edited by
        #3

        After retrieval of the mouse position as described by the preceding posting use the PointToClient method of your Panel to convert the mouse position from screen coordinates into client coordinates of your Panel.


        www.troschuetz.de

        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