├── Add-CodeGenerationRule.ps1 ├── Add-EventHandler.ps1 ├── ConvertFrom-TypeToScriptCmdlet.ps1 ├── ConvertTo-ParameterMetaData.ps1 ├── GeneratedControls ├── System.Design.ps1 └── System.Windows.Forms.ps1 ├── Readme.md ├── Set-Property.ps1 ├── Winformal.pipeworks.psd1 ├── Winformal.psd1 ├── Winformal.psm1 ├── WinformsCodeGenerationRules.ps1 └── en-us └── about_Winformal.help.txt /Add-CodeGenerationRule.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Winformal/4b1a5e675a8985460829e5ec5092dc024a550dc9/Add-CodeGenerationRule.ps1 -------------------------------------------------------------------------------- /Add-EventHandler.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Winformal/4b1a5e675a8985460829e5ec5092dc024a550dc9/Add-EventHandler.ps1 -------------------------------------------------------------------------------- /ConvertFrom-TypeToScriptCmdlet.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Winformal/4b1a5e675a8985460829e5ec5092dc024a550dc9/ConvertFrom-TypeToScriptCmdlet.ps1 -------------------------------------------------------------------------------- /ConvertTo-ParameterMetaData.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Winformal/4b1a5e675a8985460829e5ec5092dc024a550dc9/ConvertTo-ParameterMetaData.ps1 -------------------------------------------------------------------------------- /GeneratedControls/System.Design.ps1: -------------------------------------------------------------------------------- 1 | function New-ByteViewer { 2 | 3 | <# 4 | 5 | .Description 6 | Creates a new System.ComponentModel.Design.ByteViewer 7 | .Synopsis 8 | Creates a new System.ComponentModel.Design.ByteViewer 9 | .Example 10 | New-ByteViewer 11 | #> 12 | 13 | 14 | 15 | param( 16 | 17 | ${LayoutSettings}, 18 | 19 | [System.Windows.Forms.BorderStyle] 20 | ${BorderStyle}, 21 | 22 | [System.Windows.Forms.TableLayoutPanelCellBorderStyle] 23 | ${CellBorderStyle}, 24 | 25 | ${Controls}, 26 | 27 | [System.Int32] 28 | ${ColumnCount}, 29 | 30 | [System.Windows.Forms.TableLayoutPanelGrowStyle] 31 | ${GrowStyle}, 32 | 33 | [System.Int32] 34 | ${RowCount}, 35 | 36 | ${RowStyles}, 37 | 38 | ${ColumnStyles}, 39 | 40 | [Switch] 41 | ${AutoSize}, 42 | 43 | [System.Windows.Forms.AutoSizeMode] 44 | ${AutoSizeMode}, 45 | 46 | [Switch] 47 | ${TabStop}, 48 | 49 | [System.String] 50 | ${Text}, 51 | 52 | [Switch] 53 | ${AutoScroll}, 54 | 55 | ${AutoScrollMargin}, 56 | 57 | ${AutoScrollPosition}, 58 | 59 | ${AutoScrollMinSize}, 60 | 61 | [System.String] 62 | ${AccessibleDefaultActionDescription}, 63 | 64 | [System.String] 65 | ${AccessibleDescription}, 66 | 67 | [System.String] 68 | ${AccessibleName}, 69 | 70 | [System.Windows.Forms.AccessibleRole] 71 | ${AccessibleRole}, 72 | 73 | [Switch] 74 | ${AllowDrop}, 75 | 76 | [System.Windows.Forms.AnchorStyles] 77 | ${Anchor}, 78 | 79 | ${AutoScrollOffset}, 80 | 81 | ${BackColor}, 82 | 83 | ${BackgroundImage}, 84 | 85 | [System.Windows.Forms.ImageLayout] 86 | ${BackgroundImageLayout}, 87 | 88 | ${BindingContext}, 89 | 90 | ${Bounds}, 91 | 92 | [Switch] 93 | ${Capture}, 94 | 95 | [Switch] 96 | ${CausesValidation}, 97 | 98 | ${ClientSize}, 99 | 100 | ${ContextMenu}, 101 | 102 | ${ContextMenuStrip}, 103 | 104 | ${Cursor}, 105 | 106 | [System.Windows.Forms.DockStyle] 107 | ${Dock}, 108 | 109 | [Switch] 110 | ${Enabled}, 111 | 112 | ${Font}, 113 | 114 | ${ForeColor}, 115 | 116 | [System.Int32] 117 | ${Height}, 118 | 119 | [Switch] 120 | ${IsAccessible}, 121 | 122 | [System.Int32] 123 | ${Left}, 124 | 125 | ${Location}, 126 | 127 | ${Margin}, 128 | 129 | ${MaximumSize}, 130 | 131 | ${MinimumSize}, 132 | 133 | [System.String] 134 | ${Name}, 135 | 136 | ${Parent}, 137 | 138 | ${Region}, 139 | 140 | [System.Windows.Forms.RightToLeft] 141 | ${RightToLeft}, 142 | 143 | ${Site}, 144 | 145 | ${Size}, 146 | 147 | [System.Int32] 148 | ${TabIndex}, 149 | 150 | ${Tag}, 151 | 152 | [System.Int32] 153 | ${Top}, 154 | 155 | [Switch] 156 | ${UseWaitCursor}, 157 | 158 | [Switch] 159 | ${Visible}, 160 | 161 | [System.Int32] 162 | ${Width}, 163 | 164 | ${WindowTarget}, 165 | 166 | ${Padding}, 167 | 168 | [System.Windows.Forms.ImeMode] 169 | ${ImeMode}, 170 | 171 | [System.Management.Automation.ScriptBlock[]] 172 | ${On_CellPaint}, 173 | 174 | [System.Management.Automation.ScriptBlock[]] 175 | ${On_AutoSizeChanged}, 176 | 177 | [System.Management.Automation.ScriptBlock[]] 178 | ${On_KeyUp}, 179 | 180 | [System.Management.Automation.ScriptBlock[]] 181 | ${On_KeyDown}, 182 | 183 | [System.Management.Automation.ScriptBlock[]] 184 | ${On_KeyPress}, 185 | 186 | [System.Management.Automation.ScriptBlock[]] 187 | ${On_TextChanged}, 188 | 189 | [System.Management.Automation.ScriptBlock[]] 190 | ${On_Scroll}, 191 | 192 | [System.Management.Automation.ScriptBlock[]] 193 | ${On_BackColorChanged}, 194 | 195 | [System.Management.Automation.ScriptBlock[]] 196 | ${On_BackgroundImageChanged}, 197 | 198 | [System.Management.Automation.ScriptBlock[]] 199 | ${On_BackgroundImageLayoutChanged}, 200 | 201 | [System.Management.Automation.ScriptBlock[]] 202 | ${On_BindingContextChanged}, 203 | 204 | [System.Management.Automation.ScriptBlock[]] 205 | ${On_CausesValidationChanged}, 206 | 207 | [System.Management.Automation.ScriptBlock[]] 208 | ${On_ClientSizeChanged}, 209 | 210 | [System.Management.Automation.ScriptBlock[]] 211 | ${On_ContextMenuChanged}, 212 | 213 | [System.Management.Automation.ScriptBlock[]] 214 | ${On_ContextMenuStripChanged}, 215 | 216 | [System.Management.Automation.ScriptBlock[]] 217 | ${On_CursorChanged}, 218 | 219 | [System.Management.Automation.ScriptBlock[]] 220 | ${On_DockChanged}, 221 | 222 | [System.Management.Automation.ScriptBlock[]] 223 | ${On_EnabledChanged}, 224 | 225 | [System.Management.Automation.ScriptBlock[]] 226 | ${On_FontChanged}, 227 | 228 | [System.Management.Automation.ScriptBlock[]] 229 | ${On_ForeColorChanged}, 230 | 231 | [System.Management.Automation.ScriptBlock[]] 232 | ${On_LocationChanged}, 233 | 234 | [System.Management.Automation.ScriptBlock[]] 235 | ${On_MarginChanged}, 236 | 237 | [System.Management.Automation.ScriptBlock[]] 238 | ${On_RegionChanged}, 239 | 240 | [System.Management.Automation.ScriptBlock[]] 241 | ${On_RightToLeftChanged}, 242 | 243 | [System.Management.Automation.ScriptBlock[]] 244 | ${On_SizeChanged}, 245 | 246 | [System.Management.Automation.ScriptBlock[]] 247 | ${On_TabIndexChanged}, 248 | 249 | [System.Management.Automation.ScriptBlock[]] 250 | ${On_TabStopChanged}, 251 | 252 | [System.Management.Automation.ScriptBlock[]] 253 | ${On_VisibleChanged}, 254 | 255 | [System.Management.Automation.ScriptBlock[]] 256 | ${On_Click}, 257 | 258 | [System.Management.Automation.ScriptBlock[]] 259 | ${On_ControlAdded}, 260 | 261 | [System.Management.Automation.ScriptBlock[]] 262 | ${On_ControlRemoved}, 263 | 264 | [System.Management.Automation.ScriptBlock[]] 265 | ${On_DragDrop}, 266 | 267 | [System.Management.Automation.ScriptBlock[]] 268 | ${On_DragEnter}, 269 | 270 | [System.Management.Automation.ScriptBlock[]] 271 | ${On_DragOver}, 272 | 273 | [System.Management.Automation.ScriptBlock[]] 274 | ${On_DragLeave}, 275 | 276 | [System.Management.Automation.ScriptBlock[]] 277 | ${On_GiveFeedback}, 278 | 279 | [System.Management.Automation.ScriptBlock[]] 280 | ${On_HandleCreated}, 281 | 282 | [System.Management.Automation.ScriptBlock[]] 283 | ${On_HandleDestroyed}, 284 | 285 | [System.Management.Automation.ScriptBlock[]] 286 | ${On_HelpRequested}, 287 | 288 | [System.Management.Automation.ScriptBlock[]] 289 | ${On_Invalidated}, 290 | 291 | [System.Management.Automation.ScriptBlock[]] 292 | ${On_PaddingChanged}, 293 | 294 | [System.Management.Automation.ScriptBlock[]] 295 | ${On_Paint}, 296 | 297 | [System.Management.Automation.ScriptBlock[]] 298 | ${On_QueryContinueDrag}, 299 | 300 | [System.Management.Automation.ScriptBlock[]] 301 | ${On_QueryAccessibilityHelp}, 302 | 303 | [System.Management.Automation.ScriptBlock[]] 304 | ${On_DoubleClick}, 305 | 306 | [System.Management.Automation.ScriptBlock[]] 307 | ${On_Enter}, 308 | 309 | [System.Management.Automation.ScriptBlock[]] 310 | ${On_GotFocus}, 311 | 312 | [System.Management.Automation.ScriptBlock[]] 313 | ${On_Layout}, 314 | 315 | [System.Management.Automation.ScriptBlock[]] 316 | ${On_Leave}, 317 | 318 | [System.Management.Automation.ScriptBlock[]] 319 | ${On_LostFocus}, 320 | 321 | [System.Management.Automation.ScriptBlock[]] 322 | ${On_MouseClick}, 323 | 324 | [System.Management.Automation.ScriptBlock[]] 325 | ${On_MouseDoubleClick}, 326 | 327 | [System.Management.Automation.ScriptBlock[]] 328 | ${On_MouseCaptureChanged}, 329 | 330 | [System.Management.Automation.ScriptBlock[]] 331 | ${On_MouseDown}, 332 | 333 | [System.Management.Automation.ScriptBlock[]] 334 | ${On_MouseEnter}, 335 | 336 | [System.Management.Automation.ScriptBlock[]] 337 | ${On_MouseLeave}, 338 | 339 | [System.Management.Automation.ScriptBlock[]] 340 | ${On_MouseHover}, 341 | 342 | [System.Management.Automation.ScriptBlock[]] 343 | ${On_MouseMove}, 344 | 345 | [System.Management.Automation.ScriptBlock[]] 346 | ${On_MouseUp}, 347 | 348 | [System.Management.Automation.ScriptBlock[]] 349 | ${On_MouseWheel}, 350 | 351 | [System.Management.Automation.ScriptBlock[]] 352 | ${On_Move}, 353 | 354 | [System.Management.Automation.ScriptBlock[]] 355 | ${On_PreviewKeyDown}, 356 | 357 | [System.Management.Automation.ScriptBlock[]] 358 | ${On_Resize}, 359 | 360 | [System.Management.Automation.ScriptBlock[]] 361 | ${On_ChangeUICues}, 362 | 363 | [System.Management.Automation.ScriptBlock[]] 364 | ${On_StyleChanged}, 365 | 366 | [System.Management.Automation.ScriptBlock[]] 367 | ${On_SystemColorsChanged}, 368 | 369 | [System.Management.Automation.ScriptBlock[]] 370 | ${On_Validating}, 371 | 372 | [System.Management.Automation.ScriptBlock[]] 373 | ${On_Validated}, 374 | 375 | [System.Management.Automation.ScriptBlock[]] 376 | ${On_ParentChanged}, 377 | 378 | [System.Management.Automation.ScriptBlock[]] 379 | ${On_ImeModeChanged}, 380 | 381 | [System.Management.Automation.ScriptBlock[]] 382 | ${On_Disposed} 383 | ) 384 | begin { 385 | 386 | } 387 | process { 388 | 389 | $controlProperties = @{} + $psBoundParameters 390 | 391 | try { 392 | $Object = New-Object System.ComponentModel.Design.ByteViewer 393 | Set-Property -inputObject $Object -property $controlProperties 394 | } catch { 395 | Write-Error $_ 396 | return 397 | } 398 | $Object 399 | } 400 | end { 401 | 402 | } 403 | } function New-ComponentTray { 404 | 405 | <# 406 | 407 | .Description 408 | Creates a new System.Windows.Forms.Design.ComponentTray 409 | .Synopsis 410 | Creates a new System.Windows.Forms.Design.ComponentTray 411 | .Example 412 | New-ComponentTray 413 | #> 414 | 415 | 416 | 417 | param( 418 | 419 | ) 420 | begin { 421 | 422 | } 423 | process { 424 | 425 | $controlProperties = @{} + $psBoundParameters 426 | 427 | try { 428 | $Object = New-Object System.Windows.Forms.Design.ComponentTray 429 | Set-Property -inputObject $Object -property $controlProperties 430 | } catch { 431 | Write-Error $_ 432 | return 433 | } 434 | $Object 435 | } 436 | end { 437 | 438 | } 439 | } function New-CalendarAutoFormatDialog { 440 | 441 | <# 442 | 443 | .Description 444 | Creates a new System.Web.UI.Design.WebControls.CalendarAutoFormatDialog 445 | .Synopsis 446 | Creates a new System.Web.UI.Design.WebControls.CalendarAutoFormatDialog 447 | .Example 448 | New-CalendarAutoFormatDialog 449 | .Example 450 | New-CalendarAutoFormatDialog -Show 451 | .Parameter Show 452 | If Set, this will display the form and will output the object stored in the .Tag property, if one is present 453 | #> 454 | 455 | 456 | 457 | param( 458 | 459 | [Switch] 460 | ${Show} 461 | ) 462 | begin { 463 | 464 | } 465 | process { 466 | 467 | if ($psBoundParameters.ContainsKey("Show")) { 468 | $null=$psBoundParameters.Remove("Show") 469 | } 470 | 471 | $controlProperties = @{} + $psBoundParameters 472 | 473 | try { 474 | $Object = New-Object System.Web.UI.Design.WebControls.CalendarAutoFormatDialog 475 | Set-Property -inputObject $Object -property $controlProperties 476 | } catch { 477 | Write-Error $_ 478 | return 479 | } 480 | if ($show) { 481 | $showResult = $object.ShowDialog() 482 | if ($object.Tag) { 483 | $Object.Tag 484 | } 485 | return 486 | } 487 | $Object 488 | } 489 | end { 490 | 491 | } 492 | } function New-ParameterEditorUserControl { 493 | 494 | <# 495 | 496 | .Description 497 | Creates a new System.Web.UI.Design.WebControls.ParameterEditorUserControl 498 | .Synopsis 499 | Creates a new System.Web.UI.Design.WebControls.ParameterEditorUserControl 500 | .Example 501 | New-ParameterEditorUserControl 502 | #> 503 | 504 | 505 | 506 | param( 507 | 508 | ) 509 | begin { 510 | 511 | } 512 | process { 513 | 514 | $controlProperties = @{} + $psBoundParameters 515 | 516 | try { 517 | $Object = New-Object System.Web.UI.Design.WebControls.ParameterEditorUserControl 518 | Set-Property -inputObject $Object -property $controlProperties 519 | } catch { 520 | Write-Error $_ 521 | return 522 | } 523 | $Object 524 | } 525 | end { 526 | 527 | } 528 | } function New-RegexEditorDialog { 529 | 530 | <# 531 | 532 | .Description 533 | Creates a new System.Web.UI.Design.WebControls.RegexEditorDialog 534 | .Synopsis 535 | Creates a new System.Web.UI.Design.WebControls.RegexEditorDialog 536 | .Example 537 | New-RegexEditorDialog 538 | .Example 539 | New-RegexEditorDialog -Show 540 | .Parameter Show 541 | If Set, this will display the form and will output the object stored in the .Tag property, if one is present 542 | #> 543 | 544 | 545 | 546 | param( 547 | 548 | [Switch] 549 | ${Show} 550 | ) 551 | begin { 552 | 553 | } 554 | process { 555 | 556 | if ($psBoundParameters.ContainsKey("Show")) { 557 | $null=$psBoundParameters.Remove("Show") 558 | } 559 | 560 | $controlProperties = @{} + $psBoundParameters 561 | 562 | try { 563 | $Object = New-Object System.Web.UI.Design.WebControls.RegexEditorDialog 564 | Set-Property -inputObject $Object -property $controlProperties 565 | } catch { 566 | Write-Error $_ 567 | return 568 | } 569 | if ($show) { 570 | $showResult = $object.ShowDialog() 571 | if ($object.Tag) { 572 | $Object.Tag 573 | } 574 | return 575 | } 576 | $Object 577 | } 578 | end { 579 | 580 | } 581 | } -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | [Official Website](http://winformal.start-automating.com) 4 | 5 | 6 | 7 | 8 | ### Winformal is a small PowerShell module that allows you to write Winforms UI in script. This is a very simple UI written in Winformal: 9 | 10 | New-Form -controls { 11 | New-Button -Text "Click Me" -On_Click { 12 | $this.Parent.Close() 13 | } -Left 50 -Top 50 -Width 200 -Height 200 14 | } -Show 15 | 16 | 17 | #### Winformal works off of the same engine as WPK, the predecessor to ShowUI. These are both vastly superior ways to script a UI, because they are built using WPF instead of WinForms. 18 | 19 | 20 | #### WinFormal was built after a small challenge, and is a proof of concept of using the WPK engine to process different types of data. Because WinForms can do a lot less than WPF, Winformal is a lot simpler and smaller than it's cousin. Hence the name. 21 | 22 | #### If you find yourself writing Winforms in PowerShell, the least you can do is use Winformal to make life less painful. 23 | 24 | 25 | -------------------------------------------------------------------------------- /Set-Property.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Winformal/4b1a5e675a8985460829e5ec5092dc024a550dc9/Set-Property.ps1 -------------------------------------------------------------------------------- /Winformal.pipeworks.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Winformal/4b1a5e675a8985460829e5ec5092dc024a550dc9/Winformal.pipeworks.psd1 -------------------------------------------------------------------------------- /Winformal.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Winformal/4b1a5e675a8985460829e5ec5092dc024a550dc9/Winformal.psd1 -------------------------------------------------------------------------------- /Winformal.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Winformal/4b1a5e675a8985460829e5ec5092dc024a550dc9/Winformal.psm1 -------------------------------------------------------------------------------- /WinformsCodeGenerationRules.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Winformal/4b1a5e675a8985460829e5ec5092dc024a550dc9/WinformsCodeGenerationRules.ps1 -------------------------------------------------------------------------------- /en-us/about_Winformal.help.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StartAutomating/Winformal/4b1a5e675a8985460829e5ec5092dc024a550dc9/en-us/about_Winformal.help.txt --------------------------------------------------------------------------------