Winform에서 글자들을 표시할 때 사용되는 컨트롤
클래스 이름 : System.Windows.Forms.Label
기본 사용방법
Add-Type -AssemblyName System.windows.Forms
$form= New-Object System.Windows.Forms.Form
$form.Size = '200,100'
$lbl = New-Object System.Windows.Forms.Label # Label 객체 생성
$lbl.Location = '10,10' # 가로 10, 세로 10 위치
$lbl.Text = 'Hello' # Text속성에 'Hello' 문자열 입력
$form.Controls.Add($lbl)
$form.ShowDialog()
색깔 변경 방법
글자의 색(ForeColor), 글자의 배경색(BackColor)변경
$lbl = New-Object System.Windows.Forms.Label
$lbl.Location = '10,10'
$lbl.Text = 'Hello'
$lbl.ForeColor = 'Blue' #글자 색깔을 파란색으로 변경
$lbl.BackColor = 'Red' #글자 배경색을 빨간색으로 변경
글자 폰트(Font) 변경
$lbl = New-Object System.Windows.Forms.Label
$lbl.Location = '10,10'
$lbl.Text = 'Hello'
$lbl.Font = [System.Drawing.Font]::new("Microsoft Sans Serif", 14, [System.Drawing.FontStyle]::Bold)
Label의 폰트를 Microsoft Sans Serif , 글자 크기를 14, 글자를 두껍게(Bold)로 변경
'파워쉘(Powershell) > 파워쉘 GUI' 카테고리의 다른 글
파워쉘 라디오버튼(Powershell Radio button) (0) | 2024.03.27 |
---|---|
파워쉘 텍스트박스(Powershell Textbox) (0) | 2024.03.22 |
파워쉘 버튼 (Powershell Button) (0) | 2024.03.21 |
Form(WinForm-윈폼) 만들기 (0) | 2024.03.18 |
파워쉘 GUI (Graphical User Interface) (0) | 2024.03.18 |