CALCULER ET AFFICHE LE CODE COULEUR D'UNE RESISTANCE
Source / Exemple :
Public Class Form5
Inherits System.Windows.Forms.Form
#Region " Code généré par le Concepteur Windows Form "
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
'Ajoutez une initialisation quelconque après l'appel InitializeComponent()
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste des composants.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requis par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form
'Elle peut être modifiée en utilisant le Concepteur Windows Form.
'Ne la modifiez pas en utilisant l'éditeur de code.
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
Friend WithEvents Label9 As System.Windows.Forms.Label
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents ListBox2 As System.Windows.Forms.ListBox
Friend WithEvents ListBox3 As System.Windows.Forms.ListBox
Friend WithEvents ListBox4 As System.Windows.Forms.ListBox
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.MenuItem2 = New System.Windows.Forms.MenuItem
Me.MenuItem3 = New System.Windows.Forms.MenuItem
Me.Label9 = New System.Windows.Forms.Label
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.Button5 = New System.Windows.Forms.Button
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label4 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.ListBox2 = New System.Windows.Forms.ListBox
Me.ListBox3 = New System.Windows.Forms.ListBox
Me.ListBox4 = New System.Windows.Forms.ListBox
Me.Button2 = New System.Windows.Forms.Button
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'MainMenu1
'
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem2, Me.MenuItem3})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.Text = "quitter"
'
'MenuItem2
'
Me.MenuItem2.Index = 1
Me.MenuItem2.Text = "retour "
'
'MenuItem3
'
Me.MenuItem3.Index = 2
Me.MenuItem3.Text = "nouveau calcul"
'
'Label9
'
Me.Label9.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label9.Location = New System.Drawing.Point(220, 406)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(136, 72)
Me.Label9.TabIndex = 12
Me.Label9.Text = "LA VALEUR DE LA RESISTANCE EST DE"
Me.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'TextBox5
'
Me.TextBox5.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox5.Location = New System.Drawing.Point(364, 430)
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.Size = New System.Drawing.Size(120, 22)
Me.TextBox5.TabIndex = 25
Me.TextBox5.Text = ""
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(492, 430)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(48, 24)
Me.Button5.TabIndex = 32
Me.Button5.Text = "ok"
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(508, 270)
Me.TextBox4.Multiline = True
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(32, 104)
Me.TextBox4.TabIndex = 46
Me.TextBox4.Text = ""
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(404, 270)
Me.TextBox3.Multiline = True
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(32, 104)
Me.TextBox3.TabIndex = 45
Me.TextBox3.Text = ""
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(308, 270)
Me.TextBox2.Multiline = True
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(32, 104)
Me.TextBox2.TabIndex = 44
Me.TextBox2.Text = ""
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(220, 270)
Me.TextBox1.Multiline = True
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(32, 104)
Me.TextBox1.TabIndex = 43
Me.TextBox1.Text = ""
'
'Label4
'
Me.Label4.BackColor = System.Drawing.SystemColors.ControlText
Me.Label4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Label4.Location = New System.Drawing.Point(100, 318)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(80, 8)
Me.Label4.TabIndex = 40
'
'Label3
'
Me.Label3.BackColor = System.Drawing.SystemColors.ControlText
Me.Label3.Location = New System.Drawing.Point(612, 318)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(96, 8)
Me.Label3.TabIndex = 39
Me.Label3.Text = "Label3"
'
'Label2
'
Me.Label2.BackColor = System.Drawing.SystemColors.ControlDark
Me.Label2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Label2.Location = New System.Drawing.Point(180, 270)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(432, 104)
Me.Label2.TabIndex = 38
'
'Label1
'
Me.Label1.BackColor = System.Drawing.SystemColors.ActiveCaptionText
Me.Label1.Location = New System.Drawing.Point(84, 66)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(624, 56)
Me.Label1.TabIndex = 37
Me.Label1.Text = "VALEUR D'UNE RESISTANCE EN FONTION DE SONT CODE COULEUR "
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Button3
'
Me.Button3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button3.Location = New System.Drawing.Point(388, 230)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(88, 32)
Me.Button3.TabIndex = 48
Me.Button3.Text = "ANNEAU 3"
'
'Button4
'
Me.Button4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button4.Location = New System.Drawing.Point(492, 230)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(80, 32)
Me.Button4.TabIndex = 49
Me.Button4.Text = "ANNEAU 4"
'
'ListBox1
'
Me.ListBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ListBox1.ItemHeight = 15
Me.ListBox1.Items.AddRange(New Object() {"or ", "argent", "noir", "marron", "rouge", "orange", "jaune", "vert", "bleu", "gris", "blanc"})
Me.ListBox1.Location = New System.Drawing.Point(204, 170)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(72, 49)
Me.ListBox1.TabIndex = 50
'
'ListBox2
'
Me.ListBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ListBox2.ItemHeight = 15
Me.ListBox2.Items.AddRange(New Object() {"or ", "argent", "noir", "marron", "rouge", "orange", "jaune", "vert", "bleu", "gris", "blanc"})
Me.ListBox2.Location = New System.Drawing.Point(300, 170)
Me.ListBox2.Name = "ListBox2"
Me.ListBox2.Size = New System.Drawing.Size(72, 49)
Me.ListBox2.TabIndex = 51
'
'ListBox3
'
Me.ListBox3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ListBox3.ItemHeight = 15
Me.ListBox3.Items.AddRange(New Object() {"or ", "argent", "noir", "marron", "rouge", "orange", "jaune", "vert", "bleu", "gris", "blanc"})
Me.ListBox3.Location = New System.Drawing.Point(396, 170)
Me.ListBox3.Name = "ListBox3"
Me.ListBox3.Size = New System.Drawing.Size(72, 49)
Me.ListBox3.TabIndex = 52
'
'ListBox4
'
Me.ListBox4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ListBox4.ItemHeight = 15
Me.ListBox4.Items.AddRange(New Object() {"or ", "argent", "noir", "marron", "rouge", "orange", "jaune", "vert", "bleu", "gris", "blanc"})
Me.ListBox4.Location = New System.Drawing.Point(492, 170)
Me.ListBox4.Name = "ListBox4"
Me.ListBox4.Size = New System.Drawing.Size(72, 49)
Me.ListBox4.TabIndex = 53
'
'Button2
'
Me.Button2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button2.Location = New System.Drawing.Point(196, 230)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(80, 32)
Me.Button2.TabIndex = 42
Me.Button2.Text = "ANNEAU 1"
'
'Button1
'
Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button1.Location = New System.Drawing.Point(292, 230)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(80, 32)
Me.Button1.TabIndex = 47
Me.Button1.Text = "ANNEAU 2"
'
'Form5
'
Me.AutoScaleBaseSize = New System.Drawing.Size(11, 24)
Me.ClientSize = New System.Drawing.Size(792, 545)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.TextBox5)
Me.Controls.Add(Me.Label9)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.ListBox4)
Me.Controls.Add(Me.ListBox3)
Me.Controls.Add(Me.ListBox2)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Menu = Me.MainMenu1
Me.Name = "Form5"
Me.Text = "CODE COULEUR"
Me.ResumeLayout(False)
End Sub
#End Region
Dim couleur1(11), couleur2(11), couleur3(11), couleur4(11) As String, i, j, k, l, m, precis, couleur As Integer, anneau As Integer, multi As Double
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For i = 0 To 11
couleur1(i) = Val(ListBox1.SelectedIndex.ToString)
Select Case couleur1(i)
Case 0
TextBox1.BackColor = Color.Gold()
Case 1
TextBox1.BackColor = Color.Silver()
Case 2
TextBox1.BackColor = Color.Black()
Case 3
TextBox1.BackColor = Color.Brown()
Case 4
TextBox1.BackColor = Color.Red()
Case 5
TextBox1.BackColor = Color.Orange()
Case 6
TextBox1.BackColor = Color.Yellow()
Case 7
TextBox1.BackColor = Color.Green()
Case 8
TextBox1.BackColor = Color.Blue()
Case 9
TextBox1.BackColor = Color.Violet()
Case 10
TextBox1.BackColor = Color.Gray()
Case 11
TextBox1.BackColor = Color.White()
End Select
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For j = 0 To 10
couleur2(j) = Val(ListBox2.SelectedIndex.ToString)
Select Case couleur2(j)
Case 0
TextBox2.BackColor = Color.Gold()
Case 1
TextBox2.BackColor = Color.Silver()
Case 2
TextBox2.BackColor = Color.Black()
Case 3
TextBox2.BackColor = Color.Brown()
Case 4
TextBox2.BackColor = Color.Red()
Case 5
TextBox2.BackColor = Color.Orange()
Case 6
TextBox2.BackColor = Color.Yellow()
Case 7
TextBox2.BackColor = Color.Green()
Case 8
TextBox2.BackColor = Color.Blue()
Case 9
TextBox2.BackColor = Color.Violet()
Case 10
TextBox2.BackColor = Color.Gray()
Case 11
TextBox2.BackColor = Color.White()
End Select
Next
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
For k = 0 To 11
couleur3(k) = Val(ListBox3.SelectedIndex.ToString)
Select Case couleur3(k)
Case 0
TextBox3.BackColor = Color.Gold()
Case 1
TextBox3.BackColor = Color.Silver()
Case 2
TextBox3.BackColor = Color.Black()
Case 3
TextBox3.BackColor = Color.Brown()
Case 4
TextBox3.BackColor = Color.Red()
Case 5
TextBox3.BackColor = Color.Orange()
Case 6
TextBox3.BackColor = Color.Yellow()
Case 7
TextBox3.BackColor = Color.Green()
Case 8
TextBox3.BackColor = Color.Blue()
Case 9
TextBox3.BackColor = Color.Violet()
Case 10
TextBox3.BackColor = Color.Gray()
Case 11
TextBox3.BackColor = Color.White()
End Select
Next
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
For l = 0 To 11
couleur4(l) = Val(ListBox4.SelectedIndex.ToString)
Select Case couleur4(l)
Case 0
TextBox4.BackColor = Color.Gold()
Case 1
TextBox4.BackColor = Color.Silver()
Case 2
TextBox4.BackColor = Color.Black()
Case 3
TextBox4.BackColor = Color.Brown()
Case 4
TextBox4.BackColor = Color.Red()
Case 5
TextBox4.BackColor = Color.Orange()
Case 6
TextBox4.BackColor = Color.Yellow()
Case 7
TextBox4.BackColor = Color.Green()
Case 8
TextBox4.BackColor = Color.Blue()
Case 9
TextBox4.BackColor = Color.Violet()
Case 10
TextBox4.BackColor = Color.Gray()
Case 11
TextBox4.BackColor = Color.White()
End Select
Next
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
For i = 0 To 11
couleur1(i) = Val(ListBox1.SelectedIndex.ToString)
couleur2(i) = Val(ListBox2.SelectedIndex.ToString)
couleur3(i) = Val(ListBox3.SelectedIndex.ToString)
couleur4(i) = Val(ListBox4.SelectedIndex.ToString)
couleur = couleur1(i) & couleur2(i)
Select Case couleur3(m)
Case 0
multi = 0.1
Case 1
multi = 0.01
Case 2
multi = 1
Case 3
multi = 10
Case 4
multi = 100
Case 5
multi = 1000
Case 6
multi = 10000
Case 7
multi = 100000
Case 8
multi = 1000000
End Select
Select Case couleur4(m)
Case 0
precis = 10
Case 1
precis = 5
Case 2
precis = 0
Case 3
precis = 1
Case 4
precis = 2
Case 5
precis = 0
Case 6
precis = 0
Case 7
precis = 0.5
Case 8
precis = 0.25
Case 9
precis = 0.1
End Select
Button5.Visible = True
TextBox5.Text = couleur * multi & " A " & precis & " %"
Next
End Sub
End Class
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.