本帖最后由 idwma 于 2022-1-30 19:51 编辑
- Add-Type -Ass System.Windows.Forms
-
- $form1 = New-Object Windows.Forms.Form
- $timer1 = New-Object Windows.Forms.Timer
-
- $timer1_Tick = {
- $form1.Text = $form1.Text - 1
- if ($form1.Text -eq -1)
- {
- $form1.Close()
- }
- }
-
- $form1_MouseEnter = {
- $timer1.Stop()
- }
-
- $form1.Controls.Add($label1)
- $w=239
- $h=80
- $form1.ClientSize = "$w, $h"
- $form1.Text = '10'
- $form1.StartPosition = 'Manual' #对话框的位置
- $xWidth = [Windows.Forms.Screen]::PrimaryScreen.WorkingArea.Width #// 获取显示器屏幕宽度
- $yHeight = [Windows.Forms.Screen]::PrimaryScreen.WorkingArea.Height #// 高度
- $form1.Left = $xWidth/2-$w/2
- $form1.Top = $yHeight-50-$h
- $form1.add_Load($form1_Load)
- $form1.add_MouseEnter($form1_MouseEnter)
-
- # timer1
- $timer1.Enabled = $True
- $timer1.Interval = 1000
- $timer1.add_Tick($timer1_Tick)
-
- $form1.ShowDialog()
复制代码
|