IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Scripts/Batch Discussion :

Timepicker Windows form [PowerShell]


Sujet :

Scripts/Batch

  1. #1
    Membre émérite Avatar de gretch
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Avril 2006
    Messages
    1 165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux

    Informations forums :
    Inscription : Avril 2006
    Messages : 1 165
    Par défaut Timepicker Windows form
    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

  2. #2
    Rédacteur


    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    7 171
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 7 171
    Billets dans le blog
    1
    Par défaut
    Citation Envoyé par gretch Voir le message
    qq aurait une solution
    MSDN ou StackOverFlow.

  3. #3
    Membre émérite Avatar de gretch
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Avril 2006
    Messages
    1 165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux

    Informations forums :
    Inscription : Avril 2006
    Messages : 1 165
    Par défaut
    MERCI !
    c'etait cela qu'il me manquait !
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $timePicker2.ShowUpDown = $true
    LOVE !

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Delphi 2005 /Windows Forms] passage de paramêtre
    Par Frank dans le forum Delphi .NET
    Réponses: 1
    Dernier message: 28/12/2005, 17h22
  2. [VB.NET] Partager un dataset entre 2 windows forms ???
    Par kissskoool dans le forum Windows Forms
    Réponses: 11
    Dernier message: 26/07/2005, 11h34
  3. [debutant VC++ et C++] Windows form et OPENFILENAME
    Par Le Scandinave dans le forum MFC
    Réponses: 5
    Dernier message: 08/03/2005, 15h31
  4. [C#] windows form et ComboBox
    Par telynor dans le forum Windows Forms
    Réponses: 9
    Dernier message: 12/11/2004, 18h17
  5. [VB.NET] windows form traits
    Par DG JohnJohn dans le forum Windows Forms
    Réponses: 3
    Dernier message: 08/06/2004, 15h05

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo