Bonjour à tous,
Je coince un peu. J'ai 3 pictureBox dans lesquelles je veux tirer 5 traits de différentes épaisseurs. Et rien ne s'affiche (dans les Pb...). Mon code :
Pourtant, tout me parait OK. Quelqu'un aurait une idée ?
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 Private sub remplitPBoxes() Dim i As Integer = 0 Dim j As Integer = 0 Dim Pb As PictureBox = PictureBox1 Dim BlackPen As New Pen(Color.Black) For i = 0 To 2 If i = 0 Then Pb = PictureBox1 If i = 1 Then Pb = PictureBox2 If i = 2 Then Pb = PictureBox3 Pb.Refresh() Dim ObjDessin As System.Drawing.Graphics = Pb.CreateGraphics() For j = 0 To 4 nA = 233 nB = 16 + (17 * j) nC = 280 nD = 16 + (17 * j) If j = 0 Then BlackPen.Width = 1 If j = 1 Then BlackPen.Width = 2 If j = 2 Then BlackPen.Width = 3 If j = 3 Then BlackPen.Width = 4 If j = 4 Then BlackPen.Width = 5 ObjDessin.DrawLine(BlackPen, nA, nB, nC, nD) ObjDessin.SmoothingMode = SmoothingMode.AntiAlias Application.DoEvents() Next Next End sub
Partager