Bonjour,
Je cherche une astuce pour connaitre le champs actif (en saisie) en cours dans mon écran.
j'ai cela pour le Focus , cela fonctionne , mais je cherche à l'adapter ...
merci de votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 public static System.Windows.Forms.Control FindFocusedControl(System.Windows.Forms.Control container) { foreach (System.Windows.Forms.Control childControl in container.Controls) { if (childControl.Focused) { return childControl; } } foreach (System.Windows.Forms.Control childControl in container.Controls) { System.Windows.Forms.Control maybeFocusedControl = FindFocusedControl(childControl); if (maybeFocusedControl != null) { return maybeFocusedControl; } } return null; // Couldn't find any, darn! }
Partager