Bonsoir,
Dans mon 2ème projet, je réalise une mise à l'échelle/réduction, mais voilà les résultats des conversions sont parfois incorrects (exemple : 30 -----> 18, 18------>30, 50----->30, 30------>50 etc...) pour l'instant le logiciel à fait de bonnes conversions, mais parfois il fait des conversions approximatives comme (56------->33, 33-------->55) cette exemple montre que le logiciel a fait une conversion approximative (il devait convertir 33----->56 normalement)
Voilà en espérant que vous pourrez m'éclairer sur le soucis ^^
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Public Class Form1 Public num As Integer Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If TextBox1.Text <> "" And TextBox2.Text <> "" And num = 0 Then TextBox4.Text = TextBox2.Text * 60 / 100 TextBox3.Text = TextBox1.Text TextBox5.Text = (TextBox4.Text - Math.Truncate(Val(TextBox4.Text))) * 0.6 TextBox5.Text = Math.Round(Val(TextBox5.Text), 5) * 100 TextBox4.Text = Math.Truncate(Val(TextBox4.Text)) Else If num = 0 Then MsgBox("Une ou plusieurs valeurs restes à déterminer !", MsgBoxStyle.Critical, "Erreur!") End If End If If TextBox3.Text <> "" And TextBox4.Text <> "" And TextBox5.Text <> "" And num = 1 Then TextBox1.Text = TextBox3.Text TextBox2.Text = TextBox4.Text / 60 * 100 TextBox2.Text = Math.Round(Val(TextBox2.Text)) TextBox2.Text = Math.Truncate(Val(TextBox2.Text)) End If End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If num = 0 Then Timer1.Start() Timer2.Stop() End If If num = 1 Then Timer1.Stop() Timer2.Start() End If End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick TextBox3.ReadOnly = False TextBox4.ReadOnly = False TextBox5.ReadOnly = False TextBox1.ReadOnly = True TextBox2.ReadOnly = True num = 1 End Sub Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick TextBox3.ReadOnly = True TextBox4.ReadOnly = True TextBox5.ReadOnly = True TextBox1.ReadOnly = False TextBox2.ReadOnly = False num = 0 End Sub End Class
Partager