version 3

This commit is contained in:
2025-05-19 17:02:45 +02:00
parent 63d0cec45c
commit 4e70f497cd

View File

@@ -13,31 +13,31 @@ $LabelSource.Location = New-Object Drawing.Point(10, 10)
$Form.Controls.Add($LabelSource) $Form.Controls.Add($LabelSource)
$TextBoxSource = New-Object Windows.Forms.TextBox $TextBoxSource = New-Object Windows.Forms.TextBox
$TextBoxSource.Location = New-Object Drawing.Point(10, 30) $TextBoxSource.Location = New-Object Drawing.Point(10, 40)
$TextBoxSource.Size = New-Object Drawing.Size(360, 20) $TextBoxSource.Size = New-Object Drawing.Size(360, 20)
$Form.Controls.Add($TextBoxSource) $Form.Controls.Add($TextBoxSource)
# Etiqueta y campo de texto para la ruta de destino # Etiqueta y campo de texto para la ruta de destino
$LabelDestination = New-Object Windows.Forms.Label $LabelDestination = New-Object Windows.Forms.Label
$LabelDestination.Text = "Ruta de destino:" $LabelDestination.Text = "Ruta de destino:"
$LabelDestination.Location = New-Object Drawing.Point(10, 60) $LabelDestination.Location = New-Object Drawing.Point(10, 70)
$Form.Controls.Add($LabelDestination) $Form.Controls.Add($LabelDestination)
$TextBoxDestination = New-Object Windows.Forms.TextBox $TextBoxDestination = New-Object Windows.Forms.TextBox
$TextBoxDestination.Location = New-Object Drawing.Point(10, 80) $TextBoxDestination.Location = New-Object Drawing.Point(10, 100)
$TextBoxDestination.Size = New-Object Drawing.Size(360, 20) $TextBoxDestination.Size = New-Object Drawing.Size(360, 20)
$Form.Controls.Add($TextBoxDestination) $Form.Controls.Add($TextBoxDestination)
# Creamos una barra de progreso # Creamos una barra de progreso
$ProgressBar = New-Object Windows.Forms.ProgressBar $ProgressBar = New-Object Windows.Forms.ProgressBar
$ProgressBar.Location = New-Object Drawing.Point(10, 110) $ProgressBar.Location = New-Object Drawing.Point(10, 150)
$ProgressBar.Size = New-Object Drawing.Size(360, 20) $ProgressBar.Size = New-Object Drawing.Size(360, 20)
$Form.Controls.Add($ProgressBar) $Form.Controls.Add($ProgressBar)
# Creamos un botón para iniciar la copia # Creamos un botón para iniciar la copia
$Button = New-Object Windows.Forms.Button $Button = New-Object Windows.Forms.Button
$Button.Text = "Iniciar Copia" $Button.Text = "Iniciar Copia"
$Button.Location = New-Object Drawing.Point(10, 140) $Button.Location = New-Object Drawing.Point(10, 180)
$Button.Add_Click({ $Button.Add_Click({
# Obtenemos las rutas de origen y destino desde los campos de texto # Obtenemos las rutas de origen y destino desde los campos de texto
$SourcePath = $TextBoxSource.Text $SourcePath = $TextBoxSource.Text
@@ -53,5 +53,18 @@ $Button.Add_Click({
$Form.Controls.Add($Button) $Form.Controls.Add($Button)
# Crear un botón de borrado
$ButtonDelete = New-Object Windows.Forms.Button
$ButtonDelete.Text = "Borrar"
$ButtonDelete.Location = New-Object Drawing.Point(290, 180) # Ajusta la ubicación
$ButtonDelete.Size = New-Object Drawing.Size(80, 23) # Ajusta el tamaño
$Form.Controls.Add($ButtonDelete)
# Evento de clic para el botón de borrado
$ButtonDelete.Add_Click({
$TextBoxSource.Text = ""
$TextBoxDestination.Text = ""
})
# Mostramos la ventana # Mostramos la ventana
$Form.ShowDialog() $Form.ShowDialog()