Bonjour,
je voudrais savoir si comme en développement web, il existe un "z-index" avec les Windows Forms.
En effet je souhaite afficher un Combobox par-dessus une ListView.
Merci d'avance.
Bonjour,
je voudrais savoir si comme en développement web, il existe un "z-index" avec les Windows Forms.
En effet je souhaite afficher un Combobox par-dessus une ListView.
Merci d'avance.
Tu peux faire un clic droit sur ton contrôle et le mettre au premier plan ou en arrière plan.
Sinon "Affichage" -> "Autres fenêtres" -> "Structure du document"
C'est affiché par ordre de priorité et modifiable.
J'ai oublier de préciser que j'utilise Windows PowerShell ISE, je code directement en éditeur texte.
Il est peut être possible de travailler en graphique avec PowerShell ISE ???
Désolé tu est en Powershell
Apparemment c'est l'ordre d'ajout à ta form qui définit la priorité
Dans l'idée :
Code powershell : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 $form.Controls.Add($listBox1); $form.Controls.Add($listView1);
ou
Code powershell : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 $form.Controls.Add($listView1); $form.Controls.Add($listBox1);
Effectivement merci, mais cela ne fonctionne pas, car je crée le Combobox quand je double clic sur une cellule.
voici mon code :
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
# Nom de la fenetre
$ListForm = New-Object System.Windows.Forms.Form
$ListForm.Text = "nom"
$ListForm.Size = New-Object System.Drawing.Size(1280,1024)
$ListForm.StartPosition = "CenterScreen"
$ListVideo = New-Object System.Windows.Forms.ListView
$ListVideo.Location = New-Object System.Drawing.Size(10,15)
$ListVideo.Width = 1240
$ListVideo.Height = 300
$ListVideo.View = 'Details'
$ListVideo.checkboxes = $true
$ListVideo.FullRowSelect = $true
$ListVideo.GridLines = $true
$ListVideo.LabelEdit = $true
$ListVideo.AllowColumnReorder = $false
$ListVideo.Columns.Add('lol')
$ListVideo.Columns.Add('test')
$ListVideo.Columns.Add('42')
$ListVideo.Columns[0].Width = -2;
$ListVideo.Columns[1].Width = -2;
$ListVideo.Columns[2].Width = -2;
$ListVideo.Add_MouseDoubleClick($ListVideo_MouseDoubleClick)
$item = New-Object System.Windows.Forms.ListViewItem("test")
$item.SubItems.Add("125")
$item.SubItems.Add("124")
$ListVideo.Items.AddRange(($item))
$ListVideo_MouseDoubleClick={
$Click = $ListVideo.HitTest($_.Location)
Write-Host $Click.SubItem.Text #sub item clicked
Write-Host $Click.Item.Index
Write-Host $Click.SubItem.Bounds
$computerNames = @(1,2,3)
$comboBox1 = New-Object System.Windows.Forms.ComboBox
$comboBox1.Location = New-Object System.Drawing.Point(1, 1)
#$comboBox1.Location = New-Object System.Drawing.Point(($Click.SubItem.Bounds.X+10), ($Click.SubItem.Bounds.Y+40))
$comboBox1.Size = New-Object System.Drawing.Size($Click.SubItem.Bounds.Width, $Click.SubItem.Bounds.Height)
foreach($computer in $computerNames)
{
$comboBox1.Items.add($computer)
}
$ListForm.Controls.Add($comboBox1)
}
$ListForm.Controls.Add($ListVideo)
$ListForm.ShowDialog()
Tu peux utiliser la méthodes setchildindex.
https://msdn.microsoft.com/fr-fr/lib...v=vs.110).aspx
https://stackoverflow.com/questions/...lue-in-c-sharp
Je suis sur téléphone donc excuse moi pour la mise en page.
Super
un grand merci
voici le code modifier :
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 [void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") # Nom de la fenetre $ListForm = New-Object System.Windows.Forms.Form $ListForm.Text = "nom" $ListForm.Size = New-Object System.Drawing.Size(1280,1024) $ListForm.StartPosition = "CenterScreen" $ListVideo = New-Object System.Windows.Forms.ListView $ListVideo.Location = New-Object System.Drawing.Size(10,15) $ListVideo.Width = 1240 $ListVideo.Height = 300 $ListVideo.View = 'Details' $ListVideo.checkboxes = $true $ListVideo.FullRowSelect = $true $ListVideo.GridLines = $true $ListVideo.LabelEdit = $true $ListVideo.AllowColumnReorder = $false $ListVideo.Columns.Add('lol') $ListVideo.Columns.Add('test') $ListVideo.Columns.Add('42') $ListVideo.Columns[0].Width = -2; $ListVideo.Columns[1].Width = -2; $ListVideo.Columns[2].Width = -2; $ListVideo.Add_MouseDoubleClick($ListVideo_MouseDoubleClick) $item = New-Object System.Windows.Forms.ListViewItem("test") $item.SubItems.Add("125") $item.SubItems.Add("124") $ListVideo.Items.AddRange(($item)) $ListVideo_MouseDoubleClick={ $Click = $ListVideo.HitTest($_.Location) Write-Host $Click.SubItem.Text #sub item clicked Write-Host $Click.Item.Index Write-Host $Click.SubItem.Bounds $computerNames = @(1,2,3) $comboBox1 = New-Object System.Windows.Forms.ComboBox #$comboBox1.Location = New-Object System.Drawing.Point(1, 1) $comboBox1.Location = New-Object System.Drawing.Point(($Click.SubItem.Bounds.X+10), ($Click.SubItem.Bounds.Y+15)) $comboBox1.Size = New-Object System.Drawing.Size($Click.SubItem.Bounds.Width, $Click.SubItem.Bounds.Height) foreach($computer in $computerNames) { $comboBox1.Items.add($computer) } $prevIndex = $ListForm.Controls.IndexOf($ListVideo) $ListForm.Controls.Add($comboBox1); $ListForm.Controls.SetChildIndex($comboBox1, $prevIndex); } $ListForm.Controls.Add($ListVideo) $ListForm.ShowDialog()
Partager