feat: Make textbox resize with form using AutoScaleMode and Anchor

This commit is contained in:
Bobby Abellana (aider) 2025-02-21 09:43:52 -08:00
parent bbf46c9eb8
commit c70add19f6

View File

@ -12,6 +12,9 @@ $form = New-Object System.Windows.Forms.Form
$form.Text = "SharePoint XLS Converter"
$form.Size = New-Object System.Drawing.Size(600,500)
# Set AutoScaleMode to Dpi
$form.AutoScaleMode = [System.Windows.Forms.AutoScaleMode]::Dpi
# Add controls
$lblConfig = New-Object System.Windows.Forms.Label
$lblConfig.Text = "SharePoint Configuration:"
@ -67,6 +70,11 @@ $txtStatus.Location = New-Object System.Drawing.Point(20,210)
$txtStatus.Size = New-Object System.Drawing.Size(540,240)
$txtStatus.Multiline = $true
$txtStatus.ScrollBars = "Vertical"
# Anchor the textbox to the form's edges
$txtStatus.Anchor = [System.Windows.Forms.AnchorStyles]::Top -bor `
[System.Windows.Forms.AnchorStyles]::Bottom -bor `
[System.Windows.Forms.AnchorStyles]::Left -bor `
[System.Windows.Forms.AnchorStyles]::Right
$form.Controls.Add($txtStatus)
# Add Save Config button
$btnSaveConfig = New-Object System.Windows.Forms.Button