Bonjour, voici une petite interface :

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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
################################################################################ 
#
#  Nom     : C:\Program Files\PowerShell\Add-Lib\Scripts\Convert-Form\Form1.ps1
#  Version : 0.1
#  Auteur  :
#  Date    : le 11/09/2014
#
#  Généré sous PowerShell V3.0
#  Appel   : .\Convert-Form.ps1 .\Form1.Designer.cs
@"
Historique :
(Soit substitution CVS)
$Log$
(soit substitution SVN)
$LastChangedDate$
$Rev$
"@>$Null 
#
################################################################################

# Chargement des assemblies externes
[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void][Reflection.Assembly]::LoadWithPartialName("System.Drawing")

$datePicker1 = new-object System.Windows.Forms.DateTimePicker
$TimePicker2 = new-object System.Windows.Forms.DateTimePicker
$textBox1 = new-object System.Windows.Forms.TextBox
$textBox2 = new-object System.Windows.Forms.TextBox
$button1 = new-object System.Windows.Forms.Button
$button2 = new-object System.Windows.Forms.Button
$comboBox1 = new-object System.Windows.Forms.ComboBox
#
# datePicker1
#

$datePicker1.Location = new-object System.Drawing.Point(13, 66)
$datePicker1.Name = "dateTimePicker1"
$datePicker1.Size = new-object System.Drawing.Size(177, 20)
$datePicker1.TabIndex = 0
#
# TimePicker2
#

$TimePicker2.Format =[System.Windows.Forms.DateTimePickerFormat]::Time
$TimePicker2.Location = new-object System.Drawing.Point(196, 66)
$TimePicker2.Name = "TimePicker2"
$TimePicker2.Size = new-object System.Drawing.Size(82, 20)
$TimePicker2.TabIndex = 1

#
# textBox1
#

$textBox1.Location = new-object System.Drawing.Point(13, 40)
$textBox1.Name = "textBox1"
$textBox1.Size = new-object System.Drawing.Size(264, 20)
$textBox1.TabIndex = 2
$textBox1.Text = "Nom de la tâche"
function OnTextChanged_textBox1 {
    [void][System.Windows.Forms.MessageBox]::Show("L'évènement textBox1.Add_TextChanged n'est pas implémenté.")
}

$textBox1.Add_TextChanged( { OnTextChanged_textBox1 } )

#
# textBox2
#

$textBox2.Location = new-object System.Drawing.Point(13, 92)
$textBox2.Name = "textBox2"
$textBox2.Size = new-object System.Drawing.Size(231, 20)
$textBox2.TabIndex = 3
$textBox2.Text = "Command"
#
# button1
#

$button1.Location = new-object System.Drawing.Point(249, 92)
$button1.Name = "button1"
$button1.Size = new-object System.Drawing.Size(28, 20)
$button1.TabIndex = 4
$button1.Text = "..."
$button1.UseVisualStyleBackColor = $true

# Gestion event quand on clique sur le bouton Fermer
$button1.Add_Click(
{
choosefile
})

#
# button2
#

$button2.Location = new-object System.Drawing.Point(13, 118)
$button2.Name = "button2"
$button2.Size = new-object System.Drawing.Size(264, 23)
$button2.TabIndex = 5
$button2.Text = "Add"
$button2.UseVisualStyleBackColor = $true
#
# comboBox1
#

$comboBox1.FormattingEnabled = $true
$comboBox1.Location = new-object System.Drawing.Point(13, 13)
$comboBox1.Name = "comboBox1"
$comboBox1.Size = new-object System.Drawing.Size(259, 21)
$comboBox1.TabIndex = 6
$comboBox1.Text = "Serveur"



#
$Form1 = new-object System.Windows.Forms.form
#

$Form1.ClientSize = new-object System.Drawing.Size(284, 152)
$Form1.Controls.Add($comboBox1)
$Form1.Controls.Add($button2)
$Form1.Controls.Add($button1)
$Form1.Controls.Add($textBox2)
$Form1.Controls.Add($textBox1)
$Form1.Controls.Add($TimePicker2)
$Form1.Controls.Add($datePicker1)
$Form1.Name = "Form1"
$Form1.Text = "Add One shot Task"

function OnFormClosing_Form1{ 
    # $this est égal au paramètre sender (object)
    # $_ est égal au paramètre  e (eventarg)

    # Déterminer la raison de la fermeture :
    #   if (($_).CloseReason -eq [System.Windows.Forms.CloseReason]::UserClosing)

    #Autorise la fermeture
    ($_).Cancel= $False
}

########################### FUNCTIONS ###########################
function choosefile(){
$fd = New-Object system.windows.forms.openfiledialog
$fd.InitialDirectory = 'c:\scripts'
$fd.MultiSelect = $false
$fd.showdialog()
$textBox2.text = $fd.filenames
}


$Form1.Add_FormClosing( { OnFormClosing_Form1} )
$Form1.Add_Shown({$Form1.Activate()})
$ModalResult=$Form1.ShowDialog()
 #Libération de la Form
$Form1.Dispose()
mon souci se trouve au niveau de $timepicker1
j'aimerais qu'il soit un "TIMEpicker" pas un "Datepicker" (actuellement si je clique sur l'icone à coté du champs, c'est un calandrier qui s'ouvre !)

qq aurait une solution