Jeu du Black Jack avec les nombres aléatoires et les PictureBox
L'idée m'est venu d'un exemple de VB2005, dont le code était compliqué pour un débutant comme moi, j'ai fait ce programme avec un code très simple en utilisant les nombres aléatoires associées aux PictureBox et le compteur de clic pour les points et les mises, j'espère que cela sera utile aux débutants.
Source / Exemple :
Public Class Form1
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
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents Button7 As System.Windows.Forms.Button
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents NotifyIcon1 As System.Windows.Forms.NotifyIcon
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents TextBox9 As System.Windows.Forms.TextBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Public WithEvents Label5 As System.Windows.Forms.Label
Public WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents Label8 As System.Windows.Forms.Label
Public WithEvents Label9 As System.Windows.Forms.Label
Public WithEvents Label10 As System.Windows.Forms.Label
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button8 As System.Windows.Forms.Button
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox
Friend WithEvents PictureBox3 As System.Windows.Forms.PictureBox
Friend WithEvents PictureBox4 As System.Windows.Forms.PictureBox
Friend WithEvents Label11 As System.Windows.Forms.Label
Friend WithEvents Label12 As System.Windows.Forms.Label
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
Friend WithEvents PictureBox5 As System.Windows.Forms.PictureBox
Friend WithEvents PictureBox6 As System.Windows.Forms.PictureBox
Friend WithEvents PictureBox7 As System.Windows.Forms.PictureBox
Friend WithEvents Button11 As System.Windows.Forms.Button
'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.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.Button2 = New System.Windows.Forms.Button
Me.Button6 = New System.Windows.Forms.Button
Me.Button7 = New System.Windows.Forms.Button
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.Button3 = New System.Windows.Forms.Button
Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components)
Me.Button1 = New System.Windows.Forms.Button
Me.TextBox9 = New System.Windows.Forms.TextBox
Me.Label3 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Label6 = New System.Windows.Forms.Label
Me.Label7 = New System.Windows.Forms.Label
Me.Label8 = New System.Windows.Forms.Label
Me.Label9 = New System.Windows.Forms.Label
Me.Label10 = New System.Windows.Forms.Label
Me.Button5 = New System.Windows.Forms.Button
Me.Button8 = New System.Windows.Forms.Button
Me.Button11 = New System.Windows.Forms.Button
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.PictureBox2 = New System.Windows.Forms.PictureBox
Me.PictureBox3 = New System.Windows.Forms.PictureBox
Me.PictureBox4 = New System.Windows.Forms.PictureBox
Me.Label11 = New System.Windows.Forms.Label
Me.Label12 = New System.Windows.Forms.Label
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.TextBox6 = New System.Windows.Forms.TextBox
Me.TextBox7 = New System.Windows.Forms.TextBox
Me.PictureBox5 = New System.Windows.Forms.PictureBox
Me.PictureBox6 = New System.Windows.Forms.PictureBox
Me.PictureBox7 = New System.Windows.Forms.PictureBox
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox4, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox5, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox6, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox7, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox1.Location = New System.Drawing.Point(169, 194)
Me.TextBox1.Multiline = True
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.ReadOnly = True
Me.TextBox1.Size = New System.Drawing.Size(70, 70)
Me.TextBox1.TabIndex = 3
Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox2
'
Me.TextBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox2.Location = New System.Drawing.Point(245, 194)
Me.TextBox2.Multiline = True
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.ReadOnly = True
Me.TextBox2.Size = New System.Drawing.Size(70, 70)
Me.TextBox2.TabIndex = 4
Me.TextBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox3
'
Me.TextBox3.BackColor = System.Drawing.Color.White
Me.TextBox3.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox3.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox3.Location = New System.Drawing.Point(331, 194)
Me.TextBox3.Multiline = True
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.ReadOnly = True
Me.TextBox3.Size = New System.Drawing.Size(70, 70)
Me.TextBox3.TabIndex = 5
Me.TextBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'Button2
'
Me.Button2.BackColor = System.Drawing.Color.Red
Me.Button2.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
Me.Button2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button2.ForeColor = System.Drawing.Color.AliceBlue
Me.Button2.Location = New System.Drawing.Point(541, 617)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(77, 36)
Me.Button2.TabIndex = 6
Me.Button2.Text = "Quitter"
Me.Button2.UseVisualStyleBackColor = False
'
'Button6
'
Me.Button6.BackColor = System.Drawing.Color.Transparent
Me.Button6.BackgroundImage = Global.Compteur.My.Resources.Resources.ButtonRound
Me.Button6.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.Button6.FlatAppearance.BorderColor = System.Drawing.Color.DarkGreen
Me.Button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button6.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button6.ForeColor = System.Drawing.Color.Black
Me.Button6.Location = New System.Drawing.Point(260, 483)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(82, 41)
Me.Button6.TabIndex = 9
Me.Button6.Text = "Joueur"
Me.Button6.UseVisualStyleBackColor = False
'
'Button7
'
Me.Button7.BackColor = System.Drawing.Color.Transparent
Me.Button7.BackgroundImage = Global.Compteur.My.Resources.Resources.ButtonRound
Me.Button7.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.Button7.FlatAppearance.BorderColor = System.Drawing.Color.DarkGreen
Me.Button7.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button7.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button7.ForeColor = System.Drawing.Color.Black
Me.Button7.Location = New System.Drawing.Point(682, 483)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(82, 41)
Me.Button7.TabIndex = 10
Me.Button7.Text = "Donneur"
Me.Button7.UseVisualStyleBackColor = False
'
'TextBox4
'
Me.TextBox4.BackColor = System.Drawing.Color.DarkGreen
Me.TextBox4.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox4.Font = New System.Drawing.Font("Microsoft Sans Serif", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox4.ForeColor = System.Drawing.Color.Red
Me.TextBox4.Location = New System.Drawing.Point(202, 351)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.ReadOnly = True
Me.TextBox4.Size = New System.Drawing.Size(192, 40)
Me.TextBox4.TabIndex = 13
Me.TextBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'Button3
'
Me.Button3.BackColor = System.Drawing.Color.Black
Me.Button3.ForeColor = System.Drawing.Color.White
Me.Button3.Location = New System.Drawing.Point(938, 12)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(54, 23)
Me.Button3.TabIndex = 18
Me.Button3.Text = "Aide"
Me.Button3.UseVisualStyleBackColor = False
'
'NotifyIcon1
'
Me.NotifyIcon1.Icon = CType(resources.GetObject("NotifyIcon1.Icon"), System.Drawing.Icon)
Me.NotifyIcon1.Text = "Black Jack" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "dany.cap@free.fr"
Me.NotifyIcon1.Visible = True
'
'Button1
'
Me.Button1.BackColor = System.Drawing.Color.Blue
Me.Button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None
Me.Button1.FlatAppearance.BorderColor = System.Drawing.Color.White
Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button1.ForeColor = System.Drawing.Color.White
Me.Button1.Location = New System.Drawing.Point(436, 617)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(77, 36)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Crédit de 100 Euros"
Me.Button1.UseVisualStyleBackColor = False
'
'TextBox9
'
Me.TextBox9.BackColor = System.Drawing.Color.DarkGreen
Me.TextBox9.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox9.Font = New System.Drawing.Font("Microsoft Sans Serif", 26.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox9.ForeColor = System.Drawing.Color.Red
Me.TextBox9.Location = New System.Drawing.Point(632, 351)
Me.TextBox9.Name = "TextBox9"
Me.TextBox9.ReadOnly = True
Me.TextBox9.Size = New System.Drawing.Size(192, 40)
Me.TextBox9.TabIndex = 29
Me.TextBox9.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.BackColor = System.Drawing.Color.White
Me.Label3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Label3.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Label3.Font = New System.Drawing.Font("Myriad Web Pro", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.ForeColor = System.Drawing.Color.Black
Me.Label3.Location = New System.Drawing.Point(153, 474)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(67, 20)
Me.Label3.TabIndex = 31
Me.Label3.Text = "Compte"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.BackColor = System.Drawing.Color.White
Me.Label4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Label4.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Label4.Font = New System.Drawing.Font("Myriad Web Pro", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.ForeColor = System.Drawing.Color.Black
Me.Label4.Location = New System.Drawing.Point(780, 474)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(67, 20)
Me.Label4.TabIndex = 32
Me.Label4.Text = "Compte"
'
'Label5
'
Me.Label5.BackColor = System.Drawing.SystemColors.ControlLight
Me.Label5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Label5.Cursor = System.Windows.Forms.Cursors.Default
Me.Label5.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Label5.Font = New System.Drawing.Font("Myriad Web Pro", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.ForeColor = System.Drawing.Color.Red
Me.Label5.Location = New System.Drawing.Point(621, 514)
Me.Label5.Name = "Label5"
Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label5.Size = New System.Drawing.Size(40, 25)
Me.Label5.TabIndex = 33
Me.Label5.Text = "0"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label6
'
Me.Label6.BackColor = System.Drawing.SystemColors.Control
Me.Label6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Label6.Cursor = System.Windows.Forms.Cursors.Default
Me.Label6.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Label6.Font = New System.Drawing.Font("Myriad Web Pro", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label6.ForeColor = System.Drawing.Color.Red
Me.Label6.Location = New System.Drawing.Point(384, 514)
Me.Label6.Name = "Label6"
Me.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label6.Size = New System.Drawing.Size(40, 25)
Me.Label6.TabIndex = 34
Me.Label6.Text = "0"
Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label7
'
Me.Label7.AutoSize = True
Me.Label7.BackColor = System.Drawing.Color.White
Me.Label7.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Label7.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Label7.Font = New System.Drawing.Font("Myriad Web Pro", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label7.ForeColor = System.Drawing.Color.Red
Me.Label7.Location = New System.Drawing.Point(385, 474)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(57, 20)
Me.Label7.TabIndex = 35
Me.Label7.Text = "Points"
'
'Label8
'
Me.Label8.AutoSize = True
Me.Label8.BackColor = System.Drawing.Color.White
Me.Label8.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Label8.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Label8.Font = New System.Drawing.Font("Myriad Web Pro", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label8.ForeColor = System.Drawing.Color.Red
Me.Label8.Location = New System.Drawing.Point(607, 474)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(57, 20)
Me.Label8.TabIndex = 36
Me.Label8.Text = "Points"
'
'Label9
'
Me.Label9.BackColor = System.Drawing.SystemColors.Control
Me.Label9.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Label9.Cursor = System.Windows.Forms.Cursors.Default
Me.Label9.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Label9.Font = New System.Drawing.Font("Myriad Web Pro", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label9.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label9.Location = New System.Drawing.Point(152, 514)
Me.Label9.Name = "Label9"
Me.Label9.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label9.Size = New System.Drawing.Size(59, 25)
Me.Label9.TabIndex = 37
Me.Label9.Text = "100"
Me.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label10
'
Me.Label10.BackColor = System.Drawing.SystemColors.ControlLight
Me.Label10.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Label10.Cursor = System.Windows.Forms.Cursors.Default
Me.Label10.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Label10.Font = New System.Drawing.Font("Myriad Web Pro", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label10.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label10.Location = New System.Drawing.Point(779, 514)
Me.Label10.Name = "Label10"
Me.Label10.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label10.Size = New System.Drawing.Size(59, 25)
Me.Label10.TabIndex = 38
Me.Label10.Text = "100"
Me.Label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Button5
'
Me.Button5.BackColor = System.Drawing.Color.DeepPink
Me.Button5.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button5.Location = New System.Drawing.Point(477, 474)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(96, 34)
Me.Button5.TabIndex = 39
Me.Button5.Text = "Résultats"
Me.Button5.UseVisualStyleBackColor = False
'
'Button8
'
Me.Button8.BackColor = System.Drawing.Color.DarkGoldenrod
Me.Button8.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button8.ForeColor = System.Drawing.Color.Transparent
Me.Button8.Location = New System.Drawing.Point(457, 538)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(128, 39)
Me.Button8.TabIndex = 42
Me.Button8.Text = "Nouveau Jeu"
Me.Button8.UseVisualStyleBackColor = False
'
'Button11
'
Me.Button11.BackColor = System.Drawing.Color.DarkGreen
Me.Button11.BackgroundImage = CType(resources.GetObject("Button11.BackgroundImage"), System.Drawing.Image)
Me.Button11.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.Button11.FlatAppearance.BorderColor = System.Drawing.Color.DarkGreen
Me.Button11.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button11.ForeColor = System.Drawing.Color.Black
Me.Button11.Location = New System.Drawing.Point(260, 570)
Me.Button11.Name = "Button11"
Me.Button11.Size = New System.Drawing.Size(73, 33)
Me.Button11.TabIndex = 45
Me.Button11.Text = "Carte"
Me.Button11.UseVisualStyleBackColor = False
'
'PictureBox1
'
Me.PictureBox1.BackColor = System.Drawing.Color.DarkGreen
Me.PictureBox1.BackgroundImage = CType(resources.GetObject("PictureBox1.BackgroundImage"), System.Drawing.Image)
Me.PictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.PictureBox1.Location = New System.Drawing.Point(159, 194)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(80, 112)
Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox1.TabIndex = 47
Me.PictureBox1.TabStop = False
'
'PictureBox2
'
Me.PictureBox2.BackColor = System.Drawing.Color.DarkGreen
Me.PictureBox2.BackgroundImage = CType(resources.GetObject("PictureBox2.BackgroundImage"), System.Drawing.Image)
Me.PictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.PictureBox2.Location = New System.Drawing.Point(245, 194)
Me.PictureBox2.Name = "PictureBox2"
Me.PictureBox2.Size = New System.Drawing.Size(80, 112)
Me.PictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox2.TabIndex = 48
Me.PictureBox2.TabStop = False
'
'PictureBox3
'
Me.PictureBox3.BackColor = System.Drawing.Color.DarkGreen
Me.PictureBox3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.PictureBox3.Location = New System.Drawing.Point(331, 194)
Me.PictureBox3.Name = "PictureBox3"
Me.PictureBox3.Size = New System.Drawing.Size(80, 112)
Me.PictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox3.TabIndex = 49
Me.PictureBox3.TabStop = False
'
'PictureBox4
'
Me.PictureBox4.BackColor = System.Drawing.Color.Transparent
Me.PictureBox4.BackgroundImage = CType(resources.GetObject("PictureBox4.BackgroundImage"), System.Drawing.Image)
Me.PictureBox4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.PictureBox4.Location = New System.Drawing.Point(493, 29)
Me.PictureBox4.Name = "PictureBox4"
Me.PictureBox4.Size = New System.Drawing.Size(80, 112)
Me.PictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox4.TabIndex = 50
Me.PictureBox4.TabStop = False
'
'Label11
'
Me.Label11.AutoSize = True
Me.Label11.BackColor = System.Drawing.Color.DarkGreen
Me.Label11.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label11.ForeColor = System.Drawing.Color.Gold
Me.Label11.Location = New System.Drawing.Point(213, 514)
Me.Label11.Name = "Label11"
Me.Label11.Size = New System.Drawing.Size(26, 29)
Me.Label11.TabIndex = 51
Me.Label11.Text = "?"
'
'Label12
'
Me.Label12.AutoSize = True
Me.Label12.BackColor = System.Drawing.Color.DarkGreen
Me.Label12.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label12.ForeColor = System.Drawing.Color.Gold
Me.Label12.Location = New System.Drawing.Point(842, 514)
Me.Label12.Name = "Label12"
Me.Label12.Size = New System.Drawing.Size(26, 29)
Me.Label12.TabIndex = 52
Me.Label12.Text = "?"
'
'TextBox5
'
Me.TextBox5.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox5.Location = New System.Drawing.Point(798, 197)
Me.TextBox5.Multiline = True
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.ReadOnly = True
Me.TextBox5.Size = New System.Drawing.Size(70, 70)
Me.TextBox5.TabIndex = 53
Me.TextBox5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox6
'
Me.TextBox6.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox6.Location = New System.Drawing.Point(722, 197)
Me.TextBox6.Multiline = True
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.ReadOnly = True
Me.TextBox6.Size = New System.Drawing.Size(70, 70)
Me.TextBox6.TabIndex = 54
Me.TextBox6.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox7
'
Me.TextBox7.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox7.Location = New System.Drawing.Point(631, 197)
Me.TextBox7.Multiline = True
Me.TextBox7.Name = "TextBox7"
Me.TextBox7.ReadOnly = True
Me.TextBox7.Size = New System.Drawing.Size(70, 70)
Me.TextBox7.TabIndex = 55
Me.TextBox7.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'PictureBox5
'
Me.PictureBox5.BackColor = System.Drawing.Color.DarkGreen
Me.PictureBox5.BackgroundImage = CType(resources.GetObject("PictureBox5.BackgroundImage"), System.Drawing.Image)
Me.PictureBox5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.PictureBox5.Location = New System.Drawing.Point(798, 197)
Me.PictureBox5.Name = "PictureBox5"
Me.PictureBox5.Size = New System.Drawing.Size(80, 112)
Me.PictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox5.TabIndex = 56
Me.PictureBox5.TabStop = False
'
'PictureBox6
'
Me.PictureBox6.BackColor = System.Drawing.Color.DarkGreen
Me.PictureBox6.BackgroundImage = CType(resources.GetObject("PictureBox6.BackgroundImage"), System.Drawing.Image)
Me.PictureBox6.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.PictureBox6.Location = New System.Drawing.Point(712, 197)
Me.PictureBox6.Name = "PictureBox6"
Me.PictureBox6.Size = New System.Drawing.Size(80, 112)
Me.PictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox6.TabIndex = 57
Me.PictureBox6.TabStop = False
'
'PictureBox7
'
Me.PictureBox7.BackColor = System.Drawing.Color.DarkGreen
Me.PictureBox7.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.PictureBox7.Location = New System.Drawing.Point(626, 197)
Me.PictureBox7.Name = "PictureBox7"
Me.PictureBox7.Size = New System.Drawing.Size(80, 112)
Me.PictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox7.TabIndex = 58
Me.PictureBox7.TabStop = False
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.DarkGreen
Me.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.ClientSize = New System.Drawing.Size(1016, 694)
Me.Controls.Add(Me.PictureBox7)
Me.Controls.Add(Me.PictureBox6)
Me.Controls.Add(Me.PictureBox5)
Me.Controls.Add(Me.TextBox7)
Me.Controls.Add(Me.TextBox6)
Me.Controls.Add(Me.TextBox5)
Me.Controls.Add(Me.Label12)
Me.Controls.Add(Me.Label11)
Me.Controls.Add(Me.PictureBox4)
Me.Controls.Add(Me.PictureBox2)
Me.Controls.Add(Me.PictureBox1)
Me.Controls.Add(Me.Button11)
Me.Controls.Add(Me.Button8)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Label10)
Me.Controls.Add(Me.Label9)
Me.Controls.Add(Me.Label8)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.TextBox9)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.PictureBox3)
Me.Controls.Add(Me.TextBox3)
Me.ForeColor = System.Drawing.Color.Transparent
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Black Jack"
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox4, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox5, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox6, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox7, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
'Compteur de clic pour les points et les mises
Dim clic As Integer = 0
Private Sub Button6_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Randomize()
Dim value0 As Integer
Dim value1 As Integer
value0 = (12 * Rnd() + 1)
value1 = (12 * Rnd() + 1)
TextBox1.Text = value0
TextBox2.Text = value1
If Label9.Text <= "0" Then
MsgBox("Votre compte est vide: Quitter ou Créditer")
My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")
Return
End If
'Compteur de points
If TextBox1.Text = "1" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 11)
End If
If TextBox2.Text = "1" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 11)
End If
If TextBox1.Text = "2" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 2)
End If
If TextBox2.Text = "2" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 2)
End If
If TextBox1.Text = "3" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 3)
End If
If TextBox2.Text = "3" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 3)
End If
If TextBox1.Text = "4" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 4)
End If
If TextBox2.Text = "4" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 4)
End If
If TextBox1.Text = "5" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 5)
End If
If TextBox2.Text = "5" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 5)
End If
If TextBox1.Text = "6" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 6)
End If
If TextBox2.Text = "6" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 6)
End If
If TextBox1.Text = "7" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 7)
TextBox2.Text = "7"
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 7)
End If
If TextBox1.Text = "8" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 8)
End If
If TextBox2.Text = "8" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 8)
End If
If TextBox1.Text = "9" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 9)
End If
If TextBox2.Text = "9" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 9)
End If
If TextBox1.Text = "10" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
If TextBox2.Text = "10" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
If TextBox1.Text = "11" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
If TextBox2.Text = "11" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
If TextBox1.Text = "12" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
If TextBox2.Text = "12" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
If TextBox1.Text = "13" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
If TextBox2.Text = "13" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
'Association de PictureBox et de TextBox
If TextBox1.Text = "1" Then
PictureBox1.Image = My.Resources.cl1
ElseIf TextBox1.Text = "2" Then
PictureBox1.Image = My.Resources.di2
ElseIf TextBox1.Text = "3" Then
PictureBox1.Image = My.Resources.he3
ElseIf TextBox1.Text = "4" Then
PictureBox1.Image = My.Resources.sp4
ElseIf TextBox1.Text = "5" Then
PictureBox1.Image = My.Resources.cl5
ElseIf TextBox1.Text = "6" Then
PictureBox1.Image = My.Resources.di6
ElseIf TextBox1.Text = "7" Then
PictureBox1.Image = My.Resources.he7
ElseIf TextBox1.Text = "8" Then
PictureBox1.Image = My.Resources.sp8
ElseIf TextBox1.Text = "9" Then
PictureBox1.Image = My.Resources.cl9
ElseIf TextBox1.Text = "10" Then
PictureBox1.Image = My.Resources.di10
ElseIf TextBox1.Text = "11" Then
PictureBox1.Image = My.Resources.clj
ElseIf TextBox1.Text = "12" Then
PictureBox1.Image = My.Resources.diq
ElseIf TextBox1.Text = "13" Then
PictureBox1.Image = My.Resources.hek
End If
If TextBox2.Text = "1" Then
PictureBox2.Image = My.Resources.di1
ElseIf TextBox2.Text = "2" Then
PictureBox2.Image = My.Resources.he2
ElseIf TextBox2.Text = "3" Then
PictureBox2.Image = My.Resources.sp3
ElseIf TextBox2.Text = "4" Then
PictureBox2.Image = My.Resources.cl4
ElseIf TextBox2.Text = "5" Then
PictureBox2.Image = My.Resources.di5
ElseIf TextBox2.Text = "6" Then
PictureBox2.Image = My.Resources.he6
ElseIf TextBox2.Text = "7" Then
PictureBox2.Image = My.Resources.sp7
ElseIf TextBox2.Text = "8" Then
PictureBox2.Image = My.Resources.cl8
ElseIf TextBox2.Text = "9" Then
PictureBox2.Image = My.Resources.di9
ElseIf TextBox2.Text = "10" Then
PictureBox2.Image = My.Resources.he10
ElseIf TextBox2.Text = "11" Then
PictureBox2.Image = My.Resources.dij
ElseIf TextBox2.Text = "12" Then
PictureBox2.Image = My.Resources.heq
ElseIf TextBox2.Text = "13" Then
PictureBox2.Image = My.Resources.spk
End If
If Label6.Text > 21 Then
TextBox4.Text = ("Perdu" & TextBox4.Text)
End If
'Compteur de mises
If TextBox4.Text = "Perdu" Then
Label9.Visible = True
Beep()
Beep()
Label9.Text = CStr(CDbl(Label9.Text) - 10)
Label10.Visible = True
Beep()
Beep()
Label10.Text = CStr(CDbl(Label10.Text) + 10)
TextBox9.Text = ("Vainqueur" & TextBox9.Text)
My.Computer.Audio.Play("C:\Windows\Media\Tada.wav")
MsgBox("Cliquez sur Nouveau Jeu")
Return
End If
If Label6.Text = 21 Then
TextBox4.Text = ("Black Jack" & TextBox4.Text)
End If
If TextBox4.Text = "Black Jack" Then
TextBox4.Text = ("Vainqueur" & TextBox4.Text)
Label9.Visible = True
Beep()
Beep()
Label9.Text = CStr(CDbl(Label9.Text) + 10)
Label10.Visible = True
Beep()
Beep()
Label10.Text = CStr(CDbl(Label10.Text) - 10)
TextBox9.Text = ("Perdu" & TextBox9.Text)
My.Computer.Audio.Play("C:\Windows\Media\Tada.wav")
MsgBox("Cliquez sur Nouveau Jeu")
Return
End If
Dim answer As MsgBoxResult
answer = MsgBox("Voulez-vous tirer une carte?", MsgBoxStyle.YesNo)
If answer = MsgBoxResult.Yes Then
MsgBox("Jouer de nouveau")
ElseIf answer = MsgBoxResult.No Then
MsgBox("Au donneur de jouer")
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Form2.Show()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
NotifyIcon1.Icon = My.Resources.Black_Jack
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
' Message d'erreur si l'on ne clique pas sur joueur en premier
Dim aNumber As String = ""
If TextBox1.Text = "" Then
My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")
MsgBox(" C'est au Joueur de commencer! ")
Return
End If
'Bouton du Donneur il joue seul: >= 17 il est servi
Randomize()
Dim value0 As Integer
Dim value1 As Integer
Dim value2 As Integer
value0 = (12 * Rnd() + 1)
value1 = (12 * Rnd() + 1)
value2 = (12 * Rnd() + 1)
TextBox5.Text = value0
TextBox6.Text = value1
TextBox7.Text = value2
If Label9.Text <= "0" Then
MsgBox("La banque a sauté: Quitter ou créditer")
My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")
Return
End If
If TextBox5.Text = "1" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 11)
End If
If TextBox6.Text = "1" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 11)
End If
If TextBox5.Text = "2" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 2)
End If
If TextBox6.Text = "2" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 2)
End If
If TextBox5.Text = "3" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 3)
End If
If TextBox6.Text = "3" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 3)
End If
If TextBox5.Text = "4" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 4)
End If
If TextBox6.Text = "4" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 4)
End If
If TextBox5.Text = "5" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 5)
End If
If TextBox6.Text = "5" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 5)
End If
If TextBox5.Text = "6" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 6)
End If
If TextBox6.Text = "6" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 6)
End If
If TextBox5.Text = "7" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 7)
TextBox6.Text = "7"
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 7)
End If
If TextBox5.Text = "8" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 8)
End If
If TextBox6.Text = "8" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 8)
End If
If TextBox5.Text = "9" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 9)
End If
If TextBox6.Text = "9" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 9)
End If
If TextBox5.Text = "10" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox6.Text = "10" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox5.Text = "11" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox6.Text = "11" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox5.Text = "12" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox6.Text = "12" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox5.Text = "13" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox6.Text = "13" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox5.Text = "1" Then
PictureBox5.Image = My.Resources.he1
ElseIf TextBox5.Text = "2" Then
PictureBox5.Image = My.Resources.sp2
ElseIf TextBox5.Text = "3" Then
PictureBox5.Image = My.Resources.cl3
ElseIf TextBox5.Text = "4" Then
PictureBox5.Image = My.Resources.di4
ElseIf TextBox5.Text = "5" Then
PictureBox5.Image = My.Resources.he5
ElseIf TextBox5.Text = "6" Then
PictureBox5.Image = My.Resources.sp6
ElseIf TextBox5.Text = "7" Then
PictureBox5.Image = My.Resources.cl7
ElseIf TextBox5.Text = "8" Then
PictureBox5.Image = My.Resources.di8
ElseIf TextBox5.Text = "9" Then
PictureBox5.Image = My.Resources.he9
ElseIf TextBox5.Text = "10" Then
PictureBox5.Image = My.Resources.sp10
ElseIf TextBox5.Text = "11" Then
PictureBox5.Image = My.Resources.hej
ElseIf TextBox5.Text = "12" Then
PictureBox5.Image = My.Resources.spq
ElseIf TextBox5.Text = "13" Then
PictureBox5.Image = My.Resources.clk
End If
If TextBox6.Text = "1" Then
PictureBox6.Image = My.Resources.sp1
ElseIf TextBox6.Text = "2" Then
PictureBox6.Image = My.Resources.cl2
ElseIf TextBox6.Text = "3" Then
PictureBox6.Image = My.Resources.di3
ElseIf TextBox6.Text = "4" Then
PictureBox6.Image = My.Resources.he4
ElseIf TextBox6.Text = "5" Then
PictureBox6.Image = My.Resources.sp5
ElseIf TextBox6.Text = "6" Then
PictureBox6.Image = My.Resources.cl6
ElseIf TextBox6.Text = "7" Then
PictureBox6.Image = My.Resources.di7
ElseIf TextBox6.Text = "8" Then
PictureBox6.Image = My.Resources.he8
ElseIf TextBox6.Text = "9" Then
PictureBox6.Image = My.Resources.sp9
ElseIf TextBox6.Text = "10" Then
PictureBox6.Image = My.Resources.cl10
ElseIf TextBox6.Text = "11" Then
PictureBox6.Image = My.Resources.dij
ElseIf TextBox6.Text = "12" Then
PictureBox6.Image = My.Resources.heq
ElseIf TextBox6.Text = "13" Then
PictureBox6.Image = My.Resources.spk
End If
If Label5.Text > 21 Then
TextBox9.Text = ("Perdu" & TextBox9.Text)
My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")
Label5.Text = "0"
MsgBox("Cliquez sur Résultats")
Return
End If
If Label5.Text = 21 Then
TextBox9.Text = ("Black Jack" & TextBox9.Text)
My.Computer.Audio.Play("C:\Windows\Media\Tada.wav")
MsgBox("Cliquez sur Résultats")
Return
End If
'Réglé sur 17, vous pouvez changer si vous voulez rendre le jeu plus difficile pour le donneur
If Label5.Text >= 17 Then
TextBox9.Text = ("Servi" & TextBox9.Text)
MsgBox("Cliquez sur Résultats")
Return
End If
'Le TextBox7 marche si < 17
If Label5.Text < 17 Then
ElseIf TextBox7.Text = "1" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 1)
End If
If TextBox7.Text = "2" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 2)
End If
If TextBox7.Text = "3" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 3)
End If
If TextBox7.Text = "4" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 4)
End If
If TextBox7.Text = "5" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 5)
End If
If TextBox7.Text = "6" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 6)
End If
If TextBox7.Text = "7" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 7)
End If
If TextBox7.Text = "8" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 8)
End If
If TextBox7.Text = "9" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 9)
End If
If TextBox7.Text = "10" Then
Label6.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox7.Text = "11" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox7.Text = "12" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox7.Text = "13" Then
Label5.Visible = True
Beep()
Beep()
Label5.Text = CStr(CDbl(Label5.Text) + 10)
End If
If TextBox7.Text = "1" Then
PictureBox7.Image = My.Resources.di1
ElseIf TextBox7.Text = "2" Then
PictureBox7.Image = My.Resources.he2
ElseIf TextBox7.Text = "3" Then
PictureBox7.Image = My.Resources.sp3
ElseIf TextBox7.Text = "4" Then
PictureBox7.Image = My.Resources.cl4
ElseIf TextBox7.Text = "5" Then
PictureBox7.Image = My.Resources.di5
ElseIf TextBox7.Text = "6" Then
PictureBox7.Image = My.Resources.he6
ElseIf TextBox7.Text = "7" Then
PictureBox7.Image = My.Resources.sp7
ElseIf TextBox7.Text = "8" Then
PictureBox7.Image = My.Resources.cl8
ElseIf TextBox7.Text = "9" Then
PictureBox7.Image = My.Resources.di9
ElseIf TextBox7.Text = "10" Then
PictureBox7.Image = My.Resources.he10
ElseIf TextBox7.Text = "11" Then
PictureBox7.Image = My.Resources.spj
ElseIf TextBox7.Text = "12" Then
PictureBox7.Image = My.Resources.clq
ElseIf TextBox7.Text = "13" Then
PictureBox7.Image = My.Resources.dik
End If
If Label5.Text > 21 Then
TextBox9.Text = ("Perdu" & TextBox9.Text)
My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")
Label5.Text = "0"
MsgBox("Cliquez sur Résultats")
Return
End If
If Label5.Text = 21 Then
TextBox9.Text = ("Black Jack" & TextBox9.Text)
My.Computer.Audio.Play("C:\Windows\Media\Tada.wav")
MsgBox("Cliquez sur Résultats")
End If
MsgBox("Cliquez sur Résultats")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Ajoute 100? aux 2 joueurs
Label10.Visible = True
Beep()
Beep()
Label10.Text = CStr(CDbl(Label10.Text) + 100)
Label9.Visible = True
Beep()
Beep()
Label9.Text = CStr(CDbl(Label9.Text) + 100)
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
'Calcule le résultat et donne les mises
If Label5.Text = Label6.Text Then
TextBox4.Text = ("Egalité" & TextBox4.Text)
TextBox9.Text = ("Egalité" & TextBox9.Text)
End If
If Label6.Text > Label5.Text Then
TextBox4.Text = ("Vainqueur" & TextBox4.Text)
Label9.Visible = True
Beep()
Beep()
Label9.Text = CStr(CDbl(Label9.Text) + 10)
My.Computer.Audio.Play("C:\Windows\Media\Tada.wav")
End If
If Label6.Text < Label5.Text Then
TextBox9.Text = ("Vainqueur" & TextBox9.Text)
Label10.Visible = True
Beep()
Beep()
Label10.Text = CStr(CDbl(Label10.Text) + 10)
My.Computer.Audio.Play("C:\Windows\Media\Tada.wav")
End If
If Label6.Text < Label5.Text Then
TextBox4.Text = ("Perdu" & TextBox4.Text)
Label9.Visible = True
Beep()
Beep()
Label9.Text = CStr(CDbl(Label9.Text) - 10)
My.Computer.Audio.Play("C:\Windows\Media\Tada.wav")
End If
If Label6.Text > Label5.Text Then
TextBox9.Text = ("Perdu" & TextBox9.Text)
Label10.Visible = True
Beep()
Beep()
Label10.Text = CStr(CDbl(Label10.Text) - 10)
My.Computer.Audio.Play("C:\Windows\Media\Tada.wav")
End If
MsgBox("Cliquez sur Nouveau Jeu")
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
'Réinitialise le jeu pour une nouvelle partie
TextBox9.Text = ""
TextBox4.Text = ""
TextBox1.Text = ""
PictureBox1.Image = My.Resources.cardSkin
TextBox2.Text = "0"
PictureBox2.Image = My.Resources.cardSkin
TextBox3.Text = "0"
PictureBox3.Image = My.Resources.cardgreen
TextBox5.Text = "0"
PictureBox5.Image = My.Resources.cardSkin
TextBox6.Text = "0"
PictureBox6.Image = My.Resources.cardSkin
TextBox7.Text = "0"
PictureBox7.Image = My.Resources.cardgreen
Label6.Text = "0"
Label5.Text = "0"
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
' Message d'erreur si l'on ne clique pas sur joueur en premier
Dim aNumber As String = ""
If TextBox1.Text = "" Then
My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")
MsgBox(" Jouez avant de tirer une carte! ")
Return
End If
'Permet de tirer de nouvelles cartes
Randomize()
If Label9.Text <= "0" Then
MsgBox("Votre compte est vide: Quitter ou créditer")
My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")
Return
End If
Dim value0 As Integer
value0 = (12 * Rnd() + 1)
TextBox3.Text = value0
If TextBox3.Text = "1" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 1)
End If
If TextBox3.Text = "2" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 2)
End If
If TextBox3.Text = "3" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 3)
End If
If TextBox3.Text = "4" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 4)
End If
If TextBox3.Text = "5" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 5)
End If
If TextBox3.Text = "6" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 6)
End If
If TextBox3.Text = "7" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 7)
End If
If TextBox3.Text = "8" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 8)
End If
If TextBox3.Text = "9" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 9)
End If
If TextBox3.Text = "10" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
If TextBox3.Text = "11" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
If TextBox3.Text = "12" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
If TextBox3.Text = "13" Then
Label6.Visible = True
Beep()
Beep()
Label6.Text = CStr(CDbl(Label6.Text) + 10)
End If
If TextBox3.Text = "1" Then
PictureBox3.Image = My.Resources.sp1
ElseIf TextBox3.Text = "2" Then
PictureBox3.Image = My.Resources.cl2
ElseIf TextBox3.Text = "3" Then
PictureBox3.Image = My.Resources.he3
ElseIf TextBox3.Text = "4" Then
PictureBox3.Image = My.Resources.di4
ElseIf TextBox3.Text = "5" Then
PictureBox3.Image = My.Resources.sp5
ElseIf TextBox3.Text = "6" Then
PictureBox3.Image = My.Resources.cl6
ElseIf TextBox3.Text = "7" Then
PictureBox3.Image = My.Resources.di7
ElseIf TextBox3.Text = "8" Then
PictureBox3.Image = My.Resources.he8
ElseIf TextBox3.Text = "9" Then
PictureBox3.Image = My.Resources.sp9
ElseIf TextBox3.Text = "10" Then
PictureBox3.Image = My.Resources.cl10
ElseIf TextBox3.Text = "11" Then
PictureBox3.Image = My.Resources.hej
ElseIf TextBox3.Text = "12" Then
PictureBox3.Image = My.Resources.clq
ElseIf TextBox3.Text = "13" Then
PictureBox3.Image = My.Resources.dik
End If
If Label6.Text > 21 Then
TextBox4.Text = ("Perdu" & TextBox4.Text)
End If
If TextBox4.Text = "Perdu" Then
Label9.Visible = True
Beep()
Beep()
Label9.Text = CStr(CDbl(Label9.Text) - 10)
Label10.Visible = True
Beep()
Beep()
Label10.Text = CStr(CDbl(Label10.Text) + 10)
TextBox9.Text = ("Vainqueur" & TextBox9.Text)
My.Computer.Audio.Play("C:\Windows\Media\ringin.wav")
MsgBox("Cliquez sur Nouveau Jeu")
Return
End If
If Label6.Text = 21 Then
TextBox4.Text = ("Black Jack" & TextBox4.Text)
End If
If TextBox4.Text = "Black Jack" Then
TextBox4.Text = ("Vainqueur" & TextBox4.Text)
Label9.Visible = True
Beep()
Beep()
Label9.Text = CStr(CDbl(Label9.Text) + 10)
Label10.Visible = True
Beep()
Beep()
Label10.Text = CStr(CDbl(Label10.Text) - 10)
TextBox9.Text = ("Perdu" & TextBox9.Text)
My.Computer.Audio.Play("C:\Windows\Media\Tada.wav")
MsgBox("Cliquez sur Nouveau Jeu")
Return
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim answer As MsgBoxResult
answer = MsgBox("Voulez-vous quitter le Black Jack maintenant?", MsgBoxStyle.YesNo)
If answer = MsgBoxResult.Yes Then
MsgBox("A Bientôt")
End
End If
End Sub
End Class
Conclusion :
Je n'ai pas pu mettre le zip + de 1 MO, je suis désolé,je vais mettre un nouveau code moins lourd sur le même principe, d'où vous pourrez récupérer les ressources (cartes) si cela vous intéresse.
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.