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. record mouse coordinates when mouse is clicked on inkcanvas

record mouse coordinates when mouse is clicked on inkcanvas

Scheduled Pinned Locked Moved C#
help
4 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
    Naman2007
    wrote on last edited by
    #1

    I want to get the cursor coordinates when the mouse is clicked in inkcanvas.here i used mouse event handler and i am trying to display cordinates in a textbox but somehow its not working.i have used the following code snippet.can someone please help

    private void inkCanvas1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
    System.Windows.Point position = e.GetPosition(this);
    this.textBox1.Text = position.X.ToString()+","+position.Y.ToString();
    }

    S 1 Reply Last reply
    0
    • N Naman2007

      I want to get the cursor coordinates when the mouse is clicked in inkcanvas.here i used mouse event handler and i am trying to display cordinates in a textbox but somehow its not working.i have used the following code snippet.can someone please help

      private void inkCanvas1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
      {
      System.Windows.Point position = e.GetPosition(this);
      this.textBox1.Text = position.X.ToString()+","+position.Y.ToString();
      }

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #2

      I am assuming its winforms but have a look a Cursor.Position.X Further reading [System.Windows.Forms.Cursort.Position](http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.position.aspx)[[^](http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.position.aspx "New Window")] > Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - **Monty Python Spam Sketch**

      N 1 Reply Last reply
      0
      • S Simon_Whale

        I am assuming its winforms but have a look a Cursor.Position.X Further reading [System.Windows.Forms.Cursort.Position](http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.position.aspx)[[^](http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.position.aspx "New Window")] > Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - **Monty Python Spam Sketch**

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

        its WPF

        S 1 Reply Last reply
        0
        • N Naman2007

          its WPF

          S Offline
          S Offline
          Simon_Whale
          wrote on last edited by
          #4

          Have a try of this Stackoverflow WPF check mouse movement and cursor position within the left mouse button handler[^]

          Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

          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