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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
| Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Image
Imports System.Windows.Forms
Imports System
Public Class Form1
' Creation de la collection de textbox
Dim CalibriMiscFont As New System.Drawing.Font("Calibri", 20, FontStyle.Bold)
Dim CalibriMiscFontNoBold As New System.Drawing.Font("Calibri", 20)
Dim CalibriBtn As New System.Drawing.Font("Calibri", 12, FontStyle.Bold)
Dim ColNumBx As New Collections.ObjectModel.Collection(Of TextBox)
Dim ColNameBx As New Collections.ObjectModel.Collection(Of TextBox)
Dim ColDescBx As New Collections.ObjectModel.Collection(Of TextBox)
Dim ColDateBx As New Collections.ObjectModel.Collection(Of TextBox)
Dim ColRuscompBx As New Collections.ObjectModel.Collection(Of TextBox)
Dim NotesBtn As New Collections.ObjectModel.Collection(Of Button)
Dim HeightBox As Integer = 25
Dim UpperHeight As Integer = 100
Dim NumberOfBins As Integer = -1 + 18
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'--- Préparation du contexte -----------------------------------------
With Me
Dim MeX As Integer = 980
Dim MeY As Integer = 1900
.Location = New Point(5, 5)
.Size = New Size(MeY, MeX)
.BackColor = Color.White
End With
Dim NameButton As New Button
With NameButton
.Location = New Point(64, 65)
.Size = New Size(322, 32)
.Text = "Nom Du Client"
.Font = CalibriBtn
.AutoSize = False
Me.Controls.Add(NameButton)
AddHandler .Click, AddressOf Button1_Click
End With
Dim DescButton As New Button
With DescButton
.Location = New Point(387, 65)
.Size = New Size(652, 32)
.Text = "Description"
.Font = CalibriBtn
.AutoSize = False
Me.Controls.Add(DescButton)
AddHandler .Click, AddressOf Button1_Click
End With
Dim DateButton As New Button
With DateButton
.Location = New Point(1040, 65)
.Size = New Size(152, 32)
.Text = "Date"
.Font = CalibriBtn
.AutoSize = False
Me.Controls.Add(DateButton)
AddHandler .Click, AddressOf Button1_Click
End With
Dim RuscompButton As New Button
With RuscompButton
.Location = New Point(1193, 65)
.Size = New Size(162, 32)
.Text = "Ruscomp"
.Font = CalibriBtn
.AutoSize = False
Me.Controls.Add(RuscompButton)
AddHandler .Click, AddressOf Button1_Click
End With
Dim bt As New Button
With bt
.Location = New Point(255, 20)
.Text = "Colorer les textbox"
.AutoSize = True
Me.Controls.Add(bt)
AddHandler .Click, AddressOf Button1_Click
End With
Dim ct As New Button
With ct
.Location = New Point(1003, 205)
.Size = New Size(30, 30)
'.AutoSize = True
.Image = My.Resources.stickynote
Me.Controls.Add(ct)
AddHandler .Click, AddressOf Button1_Click
End With
'---------------------------------------------------------------------
'--- Creation des textboxs indexées ----------------------------------
'==========================================================================='
' =====================> Bins Number Settings <===================== '
'==========================================================================='
For i As Integer = 0 To NumberOfBins
' Creation de chaque textbox
ColNumBx.Add(New TextBox)
' Ajout du nouveau controle à la collection de controles de la feuille
Me.Controls.Add(ColNumBx(i))
' Initialisation de quelques propriétés de la textbox indexée
With ColNumBx(i)
.Name = "" & (i + 1).ToString
.Location = New Point(22, UpperHeight + (.Height + HeightBox) * i)
.Text = .Name
.BackColor = System.Drawing.SystemColors.Control
.Font = CalibriMiscFont
.Size = New Size(40, 23)
.TextAlign = HorizontalAlignment.Center
' Abonnement à 2 des évènements de la textbox
AddHandler .MouseHover, AddressOf txtNumBoxes_Normal
AddHandler .MouseLeave, AddressOf txtNumBoxes_Normal
AddHandler .GotFocus, AddressOf txtNumBoxes_Normal
End With
Next
'==========================================================================='
' =====================> END of Bins Number Settings <===================== '
'==========================================================================='
'==========================================================================='
' =====================> Textbox Name Settings <===================== '
'==========================================================================='
For i As Integer = 0 To NumberOfBins
' Creation de chaque textbox
ColNameBx.Add(New TextBox)
' Ajout du nouveau controle à la collection de controles de la feuille
Me.Controls.Add(ColNameBx(i))
' Initialisation de quelques propriétés de la textbox indexée
With ColNameBx(i)
'.Name = "T " & (i + 1).ToString
.Location = New Point(65, UpperHeight + (.Height + HeightBox) * i)
.Text = .Name
.BackColor = System.Drawing.SystemColors.Control
.Font = CalibriMiscFontNoBold
.Size = New Size(320, 23)
.TextAlign = HorizontalAlignment.Center
' Abonnement à 2 des évènements de la textbox
AddHandler .MouseEnter, AddressOf ColTxtBx_MouseEnter
AddHandler .MouseLeave, AddressOf ColTxtBx_MouseLeave
AddHandler .GotFocus, AddressOf ColTxtBx_MGotFocus
AddHandler .LostFocus, AddressOf ColTxtBx_MLostFocus
End With
Next
For i As Integer = 0 To NumberOfBins - 1
' Creation de chaque textbox
NotesBtn.Add(New Button)
' Ajout du nouveau controle à la collection de controles de la feuille
Me.Controls.Add(NotesBtn(i))
' Initialisation de quelques propriétés de la textbox indexée
With NotesBtn(i)
'.Name = "T " & (i + 1).ToString
.Location = New Point(1365, 46 * i + 106)
.Text = .Name
.BackColor = System.Drawing.SystemColors.Control
.Font = CalibriMiscFontNoBold
.Size = New Size(30, 30)
.TextAlign = HorizontalAlignment.Center
End With
Next
'==========================================================================='
' =====================> END of Textbox Name Settings <===================== '
'==========================================================================='
'==========================================================================='
' =====================> Textbox Description Settings <===================== '
'==========================================================================='
For i As Integer = 0 To NumberOfBins
' Creation de chaque textbox
ColDescBx.Add(New TextBox)
' Ajout du nouveau controle à la collection de controles de la feuille
Me.Controls.Add(ColDescBx(i))
' Initialisation de quelques propriétés de la textbox indexée
With ColDescBx(i)
.Name = ""
.Location = New Point(388, UpperHeight + (.Height + HeightBox) * i)
.Text = .Name
.BackColor = System.Drawing.SystemColors.Control
.Font = CalibriMiscFontNoBold
.Size = New Size(650, 23)
.TextAlign = HorizontalAlignment.Center
' Abonnement à 2 des évènements de la textbox
AddHandler .MouseEnter, AddressOf ColTxtBx_MouseEnter
AddHandler .MouseLeave, AddressOf ColTxtBx_MouseLeave
AddHandler .GotFocus, AddressOf ColTxtBx_MGotFocus
AddHandler .LostFocus, AddressOf ColTxtBx_MLostFocus
End With
Next
'==========================================================================='
' =====================> Textbox Date Settings <===================== '
'==========================================================================='
For i As Integer = 0 To NumberOfBins
' Creation de chaque textbox
ColDateBx.Add(New TextBox)
' Ajout du nouveau controle à la collection de controles de la feuille
Me.Controls.Add(ColDateBx(i))
' Initialisation de quelques propriétés de la textbox indexée
With ColDateBx(i)
.Name = ""
.Location = New Point(1041, UpperHeight + (.Height + HeightBox) * i)
.Text = .Name
.BackColor = System.Drawing.SystemColors.Control
.Font = CalibriMiscFontNoBold
.Size = New Size(150, 23)
.TextAlign = HorizontalAlignment.Center
' Abonnement à 2 des évènements de la textbox
AddHandler .MouseEnter, AddressOf ColTxtBx_MouseEnter
AddHandler .MouseLeave, AddressOf ColTxtBx_MouseLeave
AddHandler .GotFocus, AddressOf ColTxtBx_MGotFocus
AddHandler .LostFocus, AddressOf ColTxtBx_MLostFocus
End With
Next
'==========================================================================='
' =====================> END of Textbox Date Settings <===================== '
'==========================================================================='
'==========================================================================='
' =====================> Textbox Ruscomp Settings <===================== '
'==========================================================================='
For i As Integer = 0 To NumberOfBins
' Creation de chaque textbox
ColRuscompBx.Add(New TextBox)
' Ajout du nouveau controle à la collection de controles de la feuille
Me.Controls.Add(ColRuscompBx(i))
' Initialisation de quelques propriétés de la textbox indexée
With ColRuscompBx(i)
.Name = ""
.Location = New Point(1194, UpperHeight + (.Height + HeightBox) * i)
.Text = .Name
.BackColor = System.Drawing.SystemColors.Control
.Font = CalibriMiscFontNoBold
.Size = New Size(160, 23)
.TextAlign = HorizontalAlignment.Center
.ContextMenuStrip = CTMSColorETA
' Abonnement à 2 des évènements de la textbox
AddHandler .MouseEnter, AddressOf ColTxtBx_MouseEnter
AddHandler .MouseLeave, AddressOf ColTxtBx_MouseLeave
AddHandler .GotFocus, AddressOf ColTxtBx_MGotFocus
AddHandler .LostFocus, AddressOf ColTxtBx_MLostFocus
End With
Next
'==========================================================================='
' =====================> END of Textbox Ruscomp Settings <===================== '
'==========================================================================='
ColNameBx(3).Text = "(Client) Nom de la Personne"
ColDescBx(3).Text = "Description Du Problème <=== "
ColDateBx(3).Text = "2012-02-27"
End Sub
Private Sub txtNumBoxes_Normal(ByVal sender As Object, ByVal e As System.EventArgs)
' Récupère une référence sur le textbox déclencheur
Dim sd As TextBox = CType(sender, TextBox)
' Modification de quelques paramètres de la textbox
sd.Enabled = False
sd.Font = CalibriMiscFont
sd.BackColor = System.Drawing.SystemColors.Control
If sd.BackColor = System.Drawing.SystemColors.Control = True Then
sd.Enabled = True
End If
End Sub
Private Sub ColTxtBx_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs)
' Récupère une référence sur le textbox déclencheur
Dim sd As TextBox = CType(sender, TextBox)
' Modification de quelques paramètres de la textbox
sd.Font = New Font(sd.Font, FontStyle.Regular)
sd.BackColor = System.Drawing.SystemColors.Control
sd.ForeColor = Color.Black
sd.Font = CalibriMiscFontNoBold
End Sub
Private Sub ColTxtBx_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs)
' Récupère une référence sur le textbox déclencheur
Dim sd As TextBox = CType(sender, TextBox)
' Modification de quelques paramètres de la textbox
sd.Font = New Font(sd.Font, FontStyle.Regular)
sd.BackColor = Color.White
sd.ForeColor = Color.Black
sd.Font = CalibriMiscFontNoBold
End Sub
Private Sub ColTxtBx_MGotFocus(ByVal sender As Object, ByVal e As System.EventArgs)
' Récupère une référence sur le textbox déclencheur
Dim sd As TextBox = CType(sender, TextBox)
' Modification de quelques paramètres de la textbox
sd.Font = New Font(sd.Font, FontStyle.Regular)
sd.BackColor = Color.White
sd.ForeColor = Color.Black
sd.Font = CalibriMiscFontNoBold
RemoveHandler sd.MouseLeave, AddressOf ColTxtBx_MouseLeave
End Sub
Private Sub ColTxtBx_MLostFocus(ByVal sender As Object, ByVal e As System.EventArgs)
' Récupère une référence sur le textbox déclencheur
Dim sd As TextBox = CType(sender, TextBox)
' Modification de quelques paramètres de la textbox
sd.Font = New Font(sd.Font, FontStyle.Regular)
sd.BackColor = System.Drawing.SystemColors.Control
sd.ForeColor = Color.Black
sd.Font = CalibriMiscFontNoBold
AddHandler sd.MouseLeave, AddressOf ColTxtBx_MouseLeave
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
' Travail sur les textbox indexés
For i As Integer = 0 To ColNameBx.Count - 1
' ColNameBx(i).BackColor = Color.Red
Next
ColNameBx(3).Text = ""
ColDescBx(3).Text = ""
End Sub
Private Sub ChangerLaCouleurToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChangerLaCouleurToolStripMenuItem.Click
colorpicker.Show()
End Sub
End Class |
Partager