Skip to content

Instantly share code, notes, and snippets.

@stknohg
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stknohg/17cac931d0e0bbf3d121 to your computer and use it in GitHub Desktop.
Save stknohg/17cac931d0e0bbf3d121 to your computer and use it in GitHub Desktop.
PowerShellからWindows FormsのMonthCalendarを表示する邪道なカレンダースクリプト。
#
# PowerShellからWindows FormsのMonthCalendarを表示する邪道なカレンダースクリプト。
#
Add-Type -AssemblyName System.Windows.Forms
Try {
$Form = New-Object System.Windows.Forms.Form
$Form.Text = "邪道カレンダー"
$Form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedToolWindow
$Calendar = New-Object System.Windows.Forms.MonthCalendar
$Form.Controls.Add($Calendar)
$Form.Add_Shown({ $Calendar.Location = New-Object System.Drawing.Point @(0, 0); $Form.ClientSize = $Calendar.Size; })
$DialogResult = $Form.ShowDialog()
} Finally {
$Calendar.Dispose()
$Form.Dispose()
}
#
# PowerShellからWindows FormsのMonthCalendarを表示する邪道なカレンダースクリプト
# 終了処理を削除し最低限動作させるために必要なコードだけにまとめたバージョンです。
#
Add-Type -AssemblyName System.Windows.Forms
$Form = New-Object System.Windows.Forms.Form
$Form.Text = "邪道カレンダー"
$Form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedToolWindow
$Calendar = New-Object System.Windows.Forms.MonthCalendar
$Form.Controls.Add($Calendar)
$Form.Add_Shown({ $Calendar.Location = New-Object System.Drawing.Point @(0, 0); $Form.ClientSize = $Calendar.Size; })
$DialogResult = $Form.ShowDialog()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment