Question Alligner deux colonnes

Plus d'informations
il y a 10 ans 3 mois #21153 par Fontana
Alligner deux colonnes a été créé par Fontana
Bonjour,

J'ai un script qui me permet d'afficher la taille de mes fichers et leurs noms. Mon interface me sort deux variables que j'affiche et je n'arrive pas a les afficher correctement pour quelle soit toute ensemble.

Merci de votre aide

Mon code:

#############
# Trier les fichiers du plus grand au plus petit
# Fontana Matthieu
# Module 122
# 04.12.2015
#
# Fonctionnement
# Choisis le répértoire
# Affiche le répértoire selectionné
# récupère la taille d'un fichier ainsi que son nom
# affiche le taille et le fichier
#############






#Generated Form Function
function GenerateForm {
########################################################################
# Code Generated By: SAPIEN Technologies PrimalForms (Community Edition) v1.0.10.0
# Generated On: 02.10.2015 08:16
# Generated By: Matthieu Fontana
########################################################################

#region Import the Assemblies
[reflection.assembly]::loadwithpartialname(\"System.Windows.Forms\") | Out-Null
[reflection.assembly]::loadwithpartialname(\"System.Drawing\") | Out-Null
#endregion

#region Generated Form Objects
$form1 = New-Object System.Windows.Forms.Form
$Afficherepertorie = New-Object System.Windows.Forms.TextBox
$texteavantrep = New-Object System.Windows.Forms.Label
$LancerScript = New-Object System.Windows.Forms.Button
$boutonRepChoix = New-Object System.Windows.Forms.Button
$TextBoxafficheText = New-Object System.Windows.Forms.RichTextBox
$label1 = New-Object System.Windows.Forms.Label
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects

#
#Generated Event Script Blocks
#
#Provide Custom Code for events specified in PrimalForms.
$handler_button1_Click={
#nettoyage des valeur résiduelles.
$files=\"\"
$file=\"\"
$global:location=\"\"
$Afficherepertorie.Clear()

Add-Type -AssemblyName System.Windows.Forms
$FolderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog

[void]$FolderBrowser.ShowDialog()
$global:location = $FolderBrowser.SelectedPath
$Afficherepertorie.AppendText($global:location)
$TextBoxafficheText.clear()


}
$LancerScript_OnClick=
{



#affiche taille des fichier et sous fichier
function affichetaille {
param ([string]$chemin)
$i=0
gci $chemin -recurse -force| foreach -process {$i+=$_.length}
return $i}

$files = Get-ChildItem -Recurse -Path $global:location -Force


Foreach ($file in $files) {
#appelle ma fonction de taille
$taille = affichetaille $file
#affiche dans mon IHM la taille et le nom du fichier cote a cote
$TextBoxafficheText.AppendText(\"taille du fichier en Octet: $taille`t\")
$TextBoxafficheText.AppendText(\"nom du fichier: $file`n\")
}


}

$OnLoadForm_StateCorrection=
{#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}

#
#region Generated Form Code
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 392
$System_Drawing_Size.Width = 632
$form1.ClientSize = $System_Drawing_Size
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
$form1.Name = \"form1\"
$form1.Text = \"Primal Form\"

$Afficherepertorie.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 466
$System_Drawing_Point.Y = 79
$Afficherepertorie.Location = $System_Drawing_Point
$Afficherepertorie.Name = \"Afficherepertorie\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 20
$System_Drawing_Size.Width = 154
$Afficherepertorie.Size = $System_Drawing_Size
$Afficherepertorie.TabIndex = 5

$form1.Controls.Add($Afficherepertorie)

$texteavantrep.DataBindings.DefaultDataSourceUpdateMode = 0
$texteavantrep.Font = New-Object System.Drawing.Font(\"Microsoft Sans Serif\",15,0,3,1)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 284
$System_Drawing_Point.Y = 75
$texteavantrep.Location = $System_Drawing_Point
$texteavantrep.Name = \"texteavantrep\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 177
$texteavantrep.Size = $System_Drawing_Size
$texteavantrep.TabIndex = 4
$texteavantrep.Text = \"Vous avez choisit:\"

$form1.Controls.Add($texteavantrep)


$LancerScript.DataBindings.DefaultDataSourceUpdateMode = 0
$LancerScript.Font = New-Object System.Drawing.Font(\"Microsoft Sans Serif\",15,0,3,1)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 146
$LancerScript.Location = $System_Drawing_Point
$LancerScript.Name = \"LancerScript\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 54
$System_Drawing_Size.Width = 239
$LancerScript.Size = $System_Drawing_Size
$LancerScript.TabIndex = 3
$LancerScript.Text = \"Lance le space sniffer\"
$LancerScript.UseVisualStyleBackColor = $True
$LancerScript.add_Click($LancerScript_OnClick)

$form1.Controls.Add($LancerScript)


$boutonRepChoix.DataBindings.DefaultDataSourceUpdateMode = 0
$boutonRepChoix.Font = New-Object System.Drawing.Font(\"Microsoft Sans Serif\",15,0,3,1)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 65
$boutonRepChoix.Location = $System_Drawing_Point
$boutonRepChoix.Name = \"boutonRepChoix\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 50
$System_Drawing_Size.Width = 239
$boutonRepChoix.Size = $System_Drawing_Size
$boutonRepChoix.TabIndex = 2
$boutonRepChoix.Text = \"Choisir un répértoire\"
$boutonRepChoix.UseVisualStyleBackColor = $True
$boutonRepChoix.add_Click($handler_button1_Click)

$form1.Controls.Add($boutonRepChoix)

$TextBoxafficheText.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 219
$TextBoxafficheText.Location = $System_Drawing_Point
$TextBoxafficheText.Name = \"TextBoxafficheText\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 161
$System_Drawing_Size.Width = 608
$TextBoxafficheText.Size = $System_Drawing_Size
$TextBoxafficheText.TabIndex = 1
$TextBoxafficheText.Text = \"\"

$form1.Controls.Add($TextBoxafficheText)

$label1.DataBindings.DefaultDataSourceUpdateMode = 0
$label1.Font = New-Object System.Drawing.Font(\"Microsoft Sans Serif\",20,0,3,1)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 5
$System_Drawing_Point.Y = 5
$label1.Location = $System_Drawing_Point
$label1.Name = \"label1\"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 48
$System_Drawing_Size.Width = 302
$label1.Size = $System_Drawing_Size
$label1.TabIndex = 0
$label1.Text = \"PowerSpace Sniffer\"

$form1.Controls.Add($label1)

#endregion Generated Form Code

#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($OnLoadForm_StateCorrection)
#Show the Form
$form1.ShowDialog()| Out-Null

} #End Function

#Call the Function
GenerateForm

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 10 ans 3 mois #21158 par Philippe
Réponse de Philippe sur le sujet Re:Alligner deux colonnes
Bonjour BlackSnoww

BlackSnoww écrit:

Merci de votre aide


peut tu aussi nous aider en mettant les balises code sur les parties scripts, stp. Ca nous facilite le travail de lecture de ton code ! ;)
pour ça tu surligne ton code et tu clique sur le bouton code au dessus de la zone de saisi du texte
->tu as la possibilité d’éditer (modifier) ton premier post :P
merci :)

tu peut aussi réduire ton script à la problématique que tu a ,
ou nous indiqué les variables impliqué
ce serai mieux pour que l'on trouve une solution<br><br>Message édité par: 6ratgus, à: 4/12/15 10:08

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.039 secondes
Propulsé par Kunena