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. Program Mouse(Cursor)

Program Mouse(Cursor)

Scheduled Pinned Locked Moved C#
tutorialquestion
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.
  • C Offline
    C Offline
    Cassiopeiaxy
    wrote on last edited by
    #1

    Hi, I am currently working on a project named "motion detection to control pc". It is a project which can assist paralysed patient to access the pc using facial movement. I have a webcam capturing movement of head and translate it to mouse(cursor) movement. Do anyone have any idea on how to use codes to control/ program the mouse(cursor) movement? Thanks~

    J 1 Reply Last reply
    0
    • C Cassiopeiaxy

      Hi, I am currently working on a project named "motion detection to control pc". It is a project which can assist paralysed patient to access the pc using facial movement. I have a webcam capturing movement of head and translate it to mouse(cursor) movement. Do anyone have any idea on how to use codes to control/ program the mouse(cursor) movement? Thanks~

      J Offline
      J Offline
      Josh Smith
      wrote on last edited by
      #2

      In Windows Forms, the mouse cursor's location can be set via the static Cursor.Position property. :josh: My WPF Blog[^]

      C 1 Reply Last reply
      0
      • J Josh Smith

        In Windows Forms, the mouse cursor's location can be set via the static Cursor.Position property. :josh: My WPF Blog[^]

        C Offline
        C Offline
        Cassiopeiaxy
        wrote on last edited by
        #3

        Hi, I am a newbie towards c#, not very sure whether i did the correct way. Can you assist me? I have write a simple coding using Cursor.Position: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void MoveCursor() { if(!this.Cursor.Equals(Cursors.Default)) { this.Cursor = new Cursor(Cursor.Current.Handle); Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50); MessageBox.Show(Cursor.Position.X.ToString); } } private void Form1_Load(object sender, System.EventArgs e) { MoveCursor(); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I actually wanna do a simple codes which can read the current mouse position and write a new mouse position to it. However, the above codes cause an error: "Method 'int.ToString(string)' referenced without parentheses" which i do not the cause of this error.

        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