Last active
August 29, 2015 14:07
-
-
Save stknohg/17cac931d0e0bbf3d121 to your computer and use it in GitHub Desktop.
PowerShellからWindows FormsのMonthCalendarを表示する邪道なカレンダースクリプト。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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