demo1Form.psd1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<#
.SYNOPSIS
    Sample form definition for demo1.ps1 script

.DESCRIPTION
    This file contains form definition properties and events are loaded with new-form function in module FormsBuild

.NOTES
    Author : Claude Débieux - claude@get-code.ch
    More information and working demo on GitHub

.LINK
    https://get-code.ch
    https://github.com/get-code-ch/FormsBuilder
#>


@{
    # DialogForm Definition
    Form     = @{
        # Form properties
        Properties = @{
            Name            = 'Demo1Form'
            Text            = 'Demo1 Form'
            Width           = 400
            Height          = 400
            Anchor          = 'Left,Top'
            AutoSize        = $False
            MaximizeBox     = $False
            MinimizeBox     = $False
            ControlBox      = $True # $True or $False to show close icon on top right corner
            FormBorderStyle = 'FixedSingle' # Fixed3D, FixedDialog, FixedSingle, Sizable, None, FixedToolWindow, SizableToolWindow
        }
        # Form Events (function must defined in calling script)
        Events     = @{
            Load = 'Form_Load'    
        }
    }

    # Controls Definition
    Controls = @(
        @{
            Control    = "Label"
            Properties = @{
                Text  = 'Text'
                Name  = 'Label1'
                Top   = 7
                Left  = 5
                Width = 60
                Font = 'Arial, 11, style=Bold,Italic'
                ForeColor = 'Red'
            }
        },
        @{
            Control    = "TextBox"
            Properties = @{
                Name  = 'TextBox1'
                Top   = 7
                Left  = 70
                Width = 210
            }
            # Hanling event when text is changed
            Events     = @{
                TextChanged = 'TextBox1_OnChange'    
            }
        },
        @{
            Control    = "Label"
            Properties = @{
                Text  = 'TextBox1'
                Name  = 'Label2'
                Top   = 40
                Left  = 5
                Width = 60
            }
        },
        @{
            Control    = "Label"
            Properties = @{
                Text  = '<Text>'
                Name  = 'Label3'
                Top   = 40
                Left  = 70
                Width = 210
            }
        },
        @{
            Control    = "DataGridView"
            Properties = @{
                Name                 = 'DataGridView1'
                Top                  = 70
                Left                 = 5
                Height               = 200
                Width                = 375
                ColumnHeadersVisible = $True
                RowHeadersVisible    = $false
                SelectionMode        = 'FullRowSelect'
                MultiSelect          = $false
                ReadOnly             = $True
                
            }
            Events     = @{
                CellClick = 'DataGridView1_CellClick'
                CellDoubleClick = 'DataGridView1_CellDoubleClick'
            }
        },
        @{
            Control             = "DateTimePicker"
            Properties          = @{
                Name            = 'DateTiemPicker1'
                Top             = 280
                Left            = 5
                Width           = 170
            }
            Events     = @{
                ValueChanged     = 'DateTimePicker1_ValueChanged'
            }
        },
        @{
            Control             = "Label"
            Properties          = @{
                Name            = 'LabelDate1'
                Top             = 280
                Left            = 185
                Width           = 120
            }
        },
        # Form Quit Button
        @{
            Control    = "Button"
            Properties = @{
                Text  = 'Quit'
                Name  = 'QuitBtn'
                Top   = 315
                Left  = 170
                Width = 60
                Height = 25
            }
            Events     = @{
                Click = 'QuitBtn_Click'    
            }
        } 
    )
}