Skip to content

Instantly share code, notes, and snippets.

@m-p-3
Last active May 16, 2024 14:04
Show Gist options
  • Save m-p-3/4d57843519046b2fe2da67cb659a5a74 to your computer and use it in GitHub Desktop.
Save m-p-3/4d57843519046b2fe2da67cb659a5a74 to your computer and use it in GitHub Desktop.
Simple Digital Clock in Powershell (HH:mm:ss:ff)
Add-Type -AssemblyName System.Windows.Forms
$Form = New-Object 'System.Windows.Forms.Form'
$Form.Text = "Digital Clock"
$Form.BackColor = "#000000"
$Form.TopMost = $True
$Form.Width = 235
$Form.Height = 72
$Form.MaximizeBox = $False
$Form.FormBorderStyle = 'Fixed3D'
$clockLbl = New-Object 'System.Windows.Forms.Label'
$clockLbl.Text = (Get-Date).ToString("HH:mm:ss:ff")
$clockLbl.AutoSize = $True
$clockLbl.ForeColor = "#ff0000"
$clockLbl.Location = New-Object System.Drawing.Point(0,0)
$clockLbl.Font = "DS-Digital,32,style=Bold"
$Form.Controls.Add($clockLbl)
$timer1 = New-Object 'System.Windows.Forms.Timer'
$timer1_Tick={
$clockLbl.Text = (Get-Date).ToString("HH:mm:ss:ff")
}
$timer1.Enabled = $True
$timer1.Interval = 1
$timer1.add_Tick($timer1_Tick)
[void]$Form.ShowDialog()
$Form.Dispose()
@zzfhadr
Copy link

zzfhadr commented May 16, 2024

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment