2011-09-13 3 views
-2

C# 프로그래밍을 통해 시스템의 커서 위치에 일부 데이터를 쓰고 싶습니다.C# .NET에서 커서 위치를 얻고 해당 위치에 쓰는 방법?

커서 위치가 Cursor.position인데 그 위치에 쓸 수 없습니다.

+0

커서 위치에서'control'에 쓰고 싶습니까? –

+0

"일부 데이터"란 무엇입니까? 너는 무엇을 쓰고 싶니? winforms 또는 wpf 또는 무엇을 사용하고 있습니까? – mtijn

+0

나는 그가 마우스 커서를 프로그램 적으로 움직이기를 원한다고 생각한다. 현재 상태에 대한 질문으로 우리는 그의 의도가 무엇인지 추측 할 수 있습니다 ... – MattDavey

답변

4

이 질문의 진정한 의도를 추측하기는 어렵습니다. 그러나 여기 당신이 무엇을 물어 않는 간단한 윈폼 폼 클래스의 :

public partial class Form1 : Form { 
    public Form1() { 
     InitializeComponent(); 
     this.BackColor = this.TransparencyKey = Color.Fuchsia; 
     this.FormBorderStyle = FormBorderStyle.None; 
     var timer = new Timer() { Interval = 50, Enabled = true }; 
     timer.Tick += delegate { 
      this.Location = Cursor.Position; 
      // this.Invalidate(); // Uncomment if the text should change 
     }; 
    } 
    protected override void OnPaint(PaintEventArgs e) { 
     e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; 
     e.Graphics.DrawString("hello world", this.Font, Brushes.Black, 10, 0); 
    } 
} 

프로그램을 종료 할 수있는 방법을 찾기는 //의 할 일 항목입니다.

관련 문제