J'ai un problème d'ordre d'affichage des controls. Je trouve qu'ils sont dans l'ordre inversé.
Soit le petit code suivant :
- ouverture d'une form
- creation d'un label "UN"
- création d'un label "DEUX"
Le label "DEUX " est affiché derrière le label "UN" alors qu'il est créé après !!
Est-ce normal ?
Comment faire pour qu'il soit derrière ? (sans avoir à le créer avant)
Résultat :
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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace testcs { static class Program { /// <summary> /// Point d'entrée principal de l'application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form fForm = new Form(); Label ll1 = new Label(); ll1.Text = "UN"; ll1.BackColor = Color.Green; ll1.Location = new Point(20, 20); ll1.Size = new Size(100, 20); fForm.Controls.Add(ll1); Label ll2 = new Label(); ll2.Text = "DEUX"; ll2.BackColor = Color.Red; ll2.Location = new Point(10, 10); ll2.Size = new Size(100, 20); fForm.Controls.Add(ll2); fForm.ShowDialog(); } } }
Merci.
Partager