salut,

voilà je suis en train de faire un prog qui m'affiche tout simplement 2 lignes et plus tard une sinusoïdale.
Le problème que j'ai c'est que lorsqu'une fenêtre passe par dessus celle de mon prog, quand je regarde ensuite la fenêtre de mon prog, les lignes ont disparaissu. J'ai finir par découvrir que l'événement paint m'aiderais mais je ne vois pas comment ...
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
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
Public Class frmExo4
    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 chkAxes As System.Windows.Forms.CheckBox
    Friend WithEvents chkCourbes As System.Windows.Forms.CheckBox
    Friend WithEvents btnQuitter As System.Windows.Forms.Button
    Friend WithEvents panOption As System.Windows.Forms.Panel
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.panOption = New System.Windows.Forms.Panel
        Me.btnQuitter = New System.Windows.Forms.Button
        Me.chkCourbes = New System.Windows.Forms.CheckBox
        Me.chkAxes = New System.Windows.Forms.CheckBox
        Me.panOption.SuspendLayout()
        Me.SuspendLayout()
        '
        'panOption
        '
        Me.panOption.Controls.Add(Me.btnQuitter)
        Me.panOption.Controls.Add(Me.chkCourbes)
        Me.panOption.Controls.Add(Me.chkAxes)
        Me.panOption.Location = New System.Drawing.Point(416, 8)
        Me.panOption.Name = "panOption"
        Me.panOption.Size = New System.Drawing.Size(104, 328)
        Me.panOption.TabIndex = 0
        '
        'btnQuitter
        '
        Me.btnQuitter.Location = New System.Drawing.Point(8, 192)
        Me.btnQuitter.Name = "btnQuitter"
        Me.btnQuitter.Size = New System.Drawing.Size(88, 32)
        Me.btnQuitter.TabIndex = 2
        Me.btnQuitter.Text = "Quitter"
        '
        'chkCourbes
        '
        Me.chkCourbes.Location = New System.Drawing.Point(16, 96)
        Me.chkCourbes.Name = "chkCourbes"
        Me.chkCourbes.Size = New System.Drawing.Size(80, 24)
        Me.chkCourbes.TabIndex = 1
        Me.chkCourbes.Text = "Courbes"
        '
        'chkAxes
        '
        Me.chkAxes.Location = New System.Drawing.Point(16, 32)
        Me.chkAxes.Name = "chkAxes"
        Me.chkAxes.Size = New System.Drawing.Size(80, 24)
        Me.chkAxes.TabIndex = 0
        Me.chkAxes.Text = "Axes"
        '
        'frmExo4
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(528, 342)
        Me.Controls.Add(Me.panOption)
        Me.Name = "frmExo4"
        Me.Text = "Tracer une sinusoïde"
        Me.panOption.ResumeLayout(False)
        Me.ResumeLayout(False)
 
    End Sub
 
#End Region
 
    Private Function Peindre()
        'Cette fonction nous sert à dessiner les axes
        'ainsi que la sinusoïdale
        '
        'variable deffinissant un objet graphic pour dessiner
        Dim GraphicSinus As System.Drawing.Graphics
        'il nous faut un stylo pour dessiner
        Dim MyPen As System.Drawing.Pen
        'Variable définissant la taille de la feuille
        Dim X As Int32  'Left ou abcisse
        Dim Y As Int32  'Top ou ordonnée
 
        'Initialisation
        GraphicSinus = Me.CreateGraphics
        MyPen = New System.Drawing.Pen(System.Drawing.Color.Black)
        X = Me.Width
        Y = Me.Height
 
        'les Axes
        'nous devons enlever la longueur du panneau qui se trouve à droite
        X = X - Me.panOption.Width
        GraphicSinus.DrawLine(MyPen, 10, CInt(Y / 2), X, CInt(Y / 2))
        GraphicSinus.DrawLine(MyPen, 10, 10, 10, Y - 10)
 
 
        'Une fois le dessin fini on détruit les 2 objets de dessin
        GraphicSinus = Nothing
        MyPen = Nothing
 
    End Function
 
    Private Sub chkAxes_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkAxes.CheckedChanged
        If Me.chkAxes.Checked Then
            Peindre()
        End If
 
    End Sub
 
End Class
merci à tous.

PS : ne pouvant pas repasser ce week end j'ai mis tout mon code. Désolé si cela encombre inutilement, mais je ne pourrais répondre avant lundi aux demandes d'informations ...