Autor Beitrag
ThomAlex
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 58

Windows 7
C# (VS08) Games via XNA (privat) oder WinForms (Schule)
BeitragVerfasst: Do 19.11.09 02:32 
Hallo, habe eine kurze Frage, nämlich:

Ich möchte abfragen, ob der Cursor in einer Textbox drin ist, also im Prinzip wenn der User mit der Maus in die Textbox klickt, dann erscheint ein Cursor und dann soll etwas passieren, wie prüfe ich dass der Cursor nun drin ist?

Hier nen dummes Beispiel:

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
if (Cursor in txtbox ist drin)
{
    lblAusgabe.Text = "Cursor ist drin";
}

else 

{
    lblAusgabe.Text = "Cursor ist nicht drin";
}


Danke im vorraus

Mfg Tomalex

Moderiert von user profile iconChristian S.: C#-Tags hinzugefügt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19321
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 19.11.09 02:40 
Schau dir einmal das Event Enter an. ;-)

Bzw. um es nachträglich zu testen die Eigenschaft Focused.