The following code is an example how to create a link label using WinForms in PowerShell:
1 2 3 4 5 6 7 8 |
$LinkLabel = New-Object System.Windows.Forms.LinkLabel $LinkLabel.Location = New-Object System.Drawing.Size(20,50) $LinkLabel.Size = New-Object System.Drawing.Size(115,20) $LinkLabel.LinkColor = "#0074A2" $LinkLabel.ActiveLinkColor = "#114C7F" $LinkLabel.Text = "Your Link Text Here" $LinkLabel.add_Click({[system.Diagnostics.Process]::start("http://77.104.138.174/~powershe/power-shell.com")}) $Form.Controls.Add($LinkLabel) |
And here is a demo form showing 3 link labels:

Code:
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 |
#Create Form Object $Form = New-Object System.Windows.Forms.Form $Form.Size = New-Object System.Drawing.Size(400,300) $Form.Text = "Link Label Demo" $Form.StartPosition = "CenterScreen" #loads the window in the center of the screen #Link Label 1 $LinkLabel1 = New-Object System.Windows.Forms.LinkLabel $LinkLabel1.Location = New-Object System.Drawing.Size(30,50) $LinkLabel1.Size = New-Object System.Drawing.Size(150,20) $LinkLabel1.LinkColor = "BLUE" $LinkLabel1.ActiveLinkColor = "RED" $LinkLabel1.Text = "Your Link Text Here" $LinkLabel1.add_Click({[system.Diagnostics.Process]::start("http://technet.microsoft.com")}) $Form.Controls.Add($LinkLabel1) #Link Label 2 $LinkLabel2 = New-Object System.Windows.Forms.LinkLabel $LinkLabel2.Location = New-Object System.Drawing.Size(30,90) $LinkLabel2.Size = New-Object System.Drawing.Size(150,20) $LinkLabel2.LinkColor = "GREEN" $LinkLabel2.ActiveLinkColor = "BLUE" $LinkLabel2.Text = "Your Link Text Here" $LinkLabel2.add_Click({[system.Diagnostics.Process]::start("http://technet.microsoft.com")}) $Form.Controls.Add($LinkLabel2) #Link Label 3 $LinkLabel3 = New-Object System.Windows.Forms.LinkLabel $LinkLabel3.Location = New-Object System.Drawing.Size(30,130) $LinkLabel3.Size = New-Object System.Drawing.Size(150,20) $LinkLabel3.LinkColor = "RED" $LinkLabel3.ActiveLinkColor = "BLUE" $LinkLabel3.Text = "Your Link Text Here" $LinkLabel3.add_Click({[system.Diagnostics.Process]::start("http://technet.microsoft.com")}) $Form.Controls.Add($LinkLabel3) #Show Form $Form.ShowDialog() |


