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
|
#region Import the Assemblies
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
$frm_Main = New-Object System.Windows.Forms.Form
$btn_Export = New-Object System.Windows.Forms.Button
$lbl_Result = New-Object System.Windows.Forms.Label
$btn_Export_OnClick=
{
$lbl_Result.Text = "Génération du fichier XLS en cours. Veuillez patienter..."
$btn_Export.Enabled = $false
Start-Sleep -Milliseconds 5000
$frm_Main.Close()
}
#region Formulaire
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Width = 435
$System_Drawing_Size.Height = 550
$frm_Main.ClientSize = $System_Drawing_Size
$frm_Main.StartPosition = "CenterScreen"
$frm_Main.MaximizeBox = $false;
$frm_Main.MinimizeBox = $false;
#endregion
#region Bouton - Lancement
$btn_Export.TabIndex = 16
$btn_Export.Name = 'btn_Export'
$btn_Export.Size = New-Object System.Drawing.Size(425,30)
$btn_Export.Location = New-Object System.Drawing.Point(5,515)
$btn_Export.UseVisualStyleBackColor = $True
$btn_Export.Visible = $true
$btn_Export.Text = 'Lancer la génération du XLS'
$btn_Export.add_Click($btn_Export_OnClick)
$frm_Main.Controls.Add($btn_Export)
#endregion
#region Label - Result
$lbl_Result.Font = new-object System.Drawing.Font('Verdana', 10, [System.Drawing.FontStyle]::Bold, [System.Drawing.GraphicsUnit]::Point,0)
$lbl_Result.Size = New-Object System.Drawing.Size(435,35)
$lbl_Result.Location = new-object System.Drawing.Point(5,475)
$lbl_Result.TextAlign = [System.Drawing.ContentAlignment]::MiddleCenter
$lbl_Result.Forecolor = [System.Drawing.Color]::Green
$lbl_Result.Name = 'lbl_Result'
$lbl_Result.Text = 'Lancer la génération du XLS'
$frm_Main.Controls.Add($lbl_Result)
#endregion
#Save the initial state of the form
$InitialFormWindowState = $frm_Main.WindowState
#Show the Form
$frm_Main.ShowDialog()| Out-Null |
Partager