Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

7 commentaire(s) de dedebatou sur des sources sur tout CodeS-SourceS

Le : 13/09/2007 14:58:01
Source : COURBE 2D SANS MSCHART
Voici le module Graph.vb corrigé pour accepter les valeurs négatives:

Imports System.Drawing
Imports System.Drawing.Drawing2D

Public Class graph
    Public chartdata(0, 0) As Object
    Public CourbeVisible(100) As Boolean
    Public barVisible(100) As Boolean
    Public CurseurVisible(100) As Boolean
    Public ValeurMoyenne(100) As Boolean
    Public PenCourbe(100) As Pen
    Public Image As Bitmap

    Private PenAxe As New Pen(Color.Black, 2)
    Private PenGrill As New Pen(Color.Gray, 0)
    Private BrushTitre As Brush = Brushes.Black
    Private Bcolor As Color = Color.White
    Private ombre As Color = Color.LightGray
    Private ovisible As Boolean = True
    Private Penombre As New Pen(Color.LightGray, 2)
    Private colorgrill As Color = Color.Gray
    Private colortitre As Color = Color.Black
    Private coloraxe As Color = Color.Black
    Private BcolorGrill As Color = Color.White
    Private FontY As Font = New System.Drawing.Font("MicrosoFontTitre Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Private FontX As Font = New System.Drawing.Font("MicrosoFontTitre Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Private FTitre As Font = New System.Drawing.Font("MicrosoFontTitre Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Private titre As String = "Titre"
    Private naxex As String = ""
    Private naxey As String = ""
    Private mb As Integer = 100
    Private mh As Integer = 40
    Private ml As Integer = 50
    Private ex As Integer
    Private ey As Integer
    Private ny As Integer
    Private gg As Graphics
    Private orientX As Boolean
    Private nbc As Integer = 2
    Private nbe As Integer = 1000
    Private rcontrole As Rectangle
    Private rgraph As Rectangle
    Private pvisible As Boolean = True
    Private zoom As Boolean
    Private ccontour As Color = Color.Black
    Private cvisible As Boolean
    Private moy(100) As Double
    Private vmin As Integer

    Public ReadOnly Property Moyenne(ByVal n As Integer) As Double
        Get
            Return moy(n)
        End Get
    End Property
    Public Property CouleurContour() As Color
        Get
            Return ccontour
        End Get
        Set(ByVal value As Color)
            ccontour = value
            Me.Refresh()
        End Set
    End Property
    Public Property ContourVisible() As Boolean
        Get
            Return cvisible
        End Get
        Set(ByVal value As Boolean)
            cvisible = value
            Me.Refresh()
        End Set
    End Property
    Public Property ZoomActif() As Boolean
        Get
            Return zoom
        End Get
        Set(ByVal value As Boolean)
            zoom = value
        End Set
    End Property
    Public Property NomAxeX() As String
        Get
            Return naxex
        End Get
        Set(ByVal value As String)
            naxex = value
        End Set
    End Property
    Public Property NomAxeY() As String
        Get
            Return naxey
        End Get
        Set(ByVal value As String)
            naxey = value
        End Set
    End Property
    Public Property FontAxeX() As Font
        Get
            Return FontX
        End Get
        Set(ByVal value As Font)
            FontX = value
            Me.Refresh()
        End Set
    End Property
    Public Property FontAxeY() As Font
        Get
            Return FontY
        End Get
        Set(ByVal value As Font)
            FontY = value
            Me.Refresh()
        End Set
    End Property
    Public Property FontTitre() As Font
        Get
            Return FTitre
        End Get
        Set(ByVal value As Font)
            FTitre = value
            Me.Refresh()
        End Set
    End Property
    Public Property CouleurAxe() As Color
        Get
            Return coloraxe
        End Get
        Set(ByVal value As Color)
            coloraxe = value
            PenAxe = New Pen(colortitre, 2)
            Me.Refresh()
        End Set
    End Property
    Public Property CouleurTitre() As Color
        Get
            Return colortitre
        End Get
        Set(ByVal value As Color)
            colortitre = value
            BrushTitre = New Pen(colortitre).Brush
            Me.Refresh()
        End Set
    End Property
    Public Property NomTitre() As String
        Get
            Return titre
        End Get
        Set(ByVal value As String)
            titre = value
        End Set
    End Property
    Public Property OmbreCourbe() As Boolean
        Get
            Return ovisible
        End Get
        Set(ByVal value As Boolean)
            ovisible = value
            Me.Refresh()
        End Set
    End Property
    Public Property CouleurFond() As Color
        Get
            Return Bcolor
        End Get
        Set(ByVal value As Color)
            Bcolor = value
            Me.Refresh()
        End Set
    End Property
    Public Property CouleurFondGrille() As Color
        Get
            Return BcolorGrill
        End Get
        Set(ByVal value As Color)
            BcolorGrill = value
            Me.Refresh()
        End Set
    End Property
    Public Property CouleurGrille() As Color
        Get
            Return colorGrill
        End Get
        Set(ByVal value As Color)
            colorGrill = value
            Me.Refresh()
        End Set
    End Property
    Public Property NbCourbe() As Integer
        Get
            Return nbc
        End Get
        Set(ByVal value As Integer)
            nbc = value
            ReDim chartdata(nbe, value)
            ReDim CourbeVisible(value)
            ReDim PenCourbe(value)
        End Set
    End Property
    Public Property NbElement() As Integer
        Get
            Return nbe
        End Get
        Set(ByVal value As Integer)
            nbe = value + 1
            ReDim chartdata(value, nbc)
        End Set
    End Property
    Public Property PointVisible() As Boolean
        Get
            Return pvisible
        End Get
        Set(ByVal value As Boolean)
            pvisible = value
            Me.Refresh()
        End Set
    End Property
    Private Function maxX() As Integer
        Try
            maxX = 1
            If chartdata.GetLength(0) = 100 Then Exit Function
            Dim i As Integer
            For i = 1 To chartdata.GetLength(1) - 1
                If Len(chartdata(i, 0)) > maxX Then maxX = Len(chartdata(i, 0))
            Next

        Catch ex As Exception

        End Try
    End Function
    Private Function maxval() As Integer
        Try
            maxval = 0
            If chartdata.GetLength(0) = 100 Then Exit Function
            Dim i As Integer, j As Integer
            For i = 1 To chartdata.GetLength(1) - 1
                For j = 0 To chartdata.GetLength(0) - 1
                    If Val(chartdata(j, i)) > maxval And CourbeVisible(i) = True Then maxval = Math.Ceiling(Val(chartdata(j, i)))
                    If Val(chartdata(j, i)) > maxval And barVisible(i) = True Then maxval = Math.Ceiling(Val(chartdata(j, i)))
                    If Val(chartdata(j, i)) > maxval And CurseurVisible(i) = True Then maxval = Math.Ceiling(Val(chartdata(j, i)))
                Next
            Next

        Catch ex As Exception

        End Try
    End Function

    Private Function minval() As Integer
        Try
            minval = 0
            If chartdata.GetLength(0) = 100 Then Exit Function
            Dim i As Integer, j As Integer
            For i = 1 To chartdata.GetLength(1) - 1
                For j = 0 To chartdata.GetLength(0) - 1
                    If Val(chartdata(j, i)) < minval And CourbeVisible(i) = True Then minval = Math.Ceiling(Val(chartdata(j, i)))
                    If Val(chartdata(j, i)) < minval And barVisible(i) = True Then minval = Math.Ceiling(Val(chartdata(j, i)))
                    If Val(chartdata(j, i)) < minval And CurseurVisible(i) = True Then minval = Math.Ceiling(Val(chartdata(j, i)))
                Next
            Next

        Catch ex As Exception

        End Try
    End Function

    Private Sub Fond_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Fond.Paint
        Image = New Bitmap(Fond.Width, Fond.Height)
        Dim g As Graphics = Graphics.FromImage(Image)
        Dim gf As Graphics = Fond.CreateGraphics
        g.SmoothingMode = SmoothingMode.AntiAlias
        Try
            'calcul la marge droite et gauche
            ml = (FontY.GetHeight * (1 + Len(CStr(maxval())))) * 1.6
            'calcule de la marge basse
            mb = (FontX.GetHeight + 10) * 2
            'calcule marge basse si ecriture verticale
            orientX = False
            If (Fond.Width - (2 * ml)) / chartdata.GetLength(0) < (FontX.GetHeight * maxX() * 0.6) Then
                mb = (maxX() * FontX.GetHeight * 0.5) + 10 + (FontX.GetHeight + 10)
                orientX = True
            End If
            'dessine fond du graph
            dessinefond(g)
            dessgrille(g)
            'dessine axe x
            dessineaxe(g)
            dessinebar(g)
            dessinecurseur(g)
            desscourbe(g)
            dessinemoyenne(g)

            gf.DrawImage(Image, 0, 0)
            g.Dispose()
            gf.Dispose()
        Catch ex As Exception

        End Try
    End Sub
    Private Sub dessineaxe(ByVal g As Graphics)
        Try
            PenAxe = New Pen(coloraxe, 2)
            g.DrawLine(PenAxe, ml - 5, Fond.Height - mb, Fond.Width - ml + 5, Fond.Height - mb)
            'dessine axe y
            g.DrawLine(PenAxe, ml, mh, ml, Fond.Height - (mb - 5))
            'g.DrawLine(PenAxe, Fond.Width - ml, mh, Fond.Width - ml, Fond.Height - (mb - 5))
            'affiche nom axe x
            g.DrawString(naxex, FontX, PenAxe.Brush, (Fond.Width - FontX.GetHeight * 0.5 * naxex.Length) / 2, Fond.Height - FontX.GetHeight - 10)
            'affiche nom axe y
            Dim sf As StringFormat = StringFormat.GenericTypographic
            sf.FormatFlags = StringFormatFlags.DirectionVertical
            g.DrawString(naxey, FontY, PenAxe.Brush, 10, (Fond.Height - mb - mh) / 2, sf)
            ' g.DrawString(naxey, FontY, PenAxe.Brush, Fond.Width - 10 - FontY.GetHeight, (Fond.Height - mb - mh) / 2, sf)

        Catch ex As Exception

        End Try
    End Sub
    Private Sub dessinefond(ByVal g As Graphics)
        Try
            rcontrole = New Rectangle(0, 0, Fond.Width, Fond.Height)
            rgraph = New Rectangle(ml, mh, Fond.Width - (2 * ml), Fond.Height - mh - mb)
            Dim lbrush As New LinearGradientBrush(rcontrole, Bcolor, Color.WhiteSmoke, LinearGradientMode.ForwardDiagonal)
            g.FillRectangle(lbrush, rcontrole)
            lbrush = New LinearGradientBrush(rgraph, BcolorGrill, Color.WhiteSmoke, LinearGradientMode.Horizontal)
            g.FillRectangle(lbrush, rgraph)

            Dim tp As New Pen(ccontour, 2)
            If cvisible = True Then
                g.DrawRectangle(tp, Math.Abs(Fond.Left), Fond.Top, Me.Width - 1, Me.Height - 1)
            End If

        Catch ex As Exception

        End Try
    End Sub
    Private Sub dessgrille(ByVal g As Graphics)
        Dim i As Integer, j As Integer, v As Integer, xx As Integer, yy As Integer, ec As Integer, it As Integer
        Try
            'affiche le titre
            PenAxe = New Pen(coloraxe, 2)
            ombre = Color.FromArgb(128, ombre.R, ombre.G, ombre.B)
            Penombre = New Pen(ombre, PenCourbe(i).Width)
            Penombre.StartCap = LineCap.Round
            If ovisible = True Then g.DrawString(titre, FontTitre, Penombre.Brush, (Fond.Width / 2 - (titre.Length * FontTitre.GetHeight) / 4) + 3, 8)
            g.DrawString(titre, FontTitre, BrushTitre, (Fond.Width / 2 - (titre.Length * FontTitre.GetHeight) / 4), 5)
            'trouve la valeur max de l'axe y
            v = maxval()
            vmin = minval()
            'calcule longeur des axe
            xx = Fond.Width - (2 * ml)
            yy = (Fond.Height - mb) - mh
            'calcule echelle y
            ec = ((yy) / (v - vmin))
            If ec = 0 Then ec = 1
            If ec < 20 Then
                i = Math.Ceiling(20 / ec)
                ec = ec * i
            End If
            it = Math.Ceiling((v - vmin) / (yy / ec))
            ey = it
            ny = ec
            j = vmin
            Dim lg As Integer
            PenGrill = New Pen(colorgrill, 1)
            PenGrill.DashStyle = DashStyle.Dash
            For i = 0 To yy Step ec
                lg = Len(CStr(j)) * (FontY.GetHeight * 0.5)
                g.DrawLine(PenGrill, ml - 5, Fond.Height - mb - i, Fond.Width - ml + 5, Fond.Height - mb - i)
                g.DrawString(CStr(j), FontY, PenAxe.Brush, ml - 10 - lg, Fond.Height - mb - i - (FontY.GetHeight / 2))
                'g.DrawString(CStr(j), FontY, PenAxe.Brush, Fond.Width - ml + 5, Fond.Height - mb - i - (FontY.GetHeight / 2))
                j = j + it
            Next
            'calcul echelle x
            ec = Fix((xx * 100) / (chartdata.GetLength(0)))
            j = 0
            ex = ec
            Dim mx As Integer = -1
            Dim ii As Integer
            For i = 0 To (xx * 100) - ec Step ec
                ii = i / 100
                g.DrawLine(PenGrill, ml + ii, Fond.Height - mb + 5, ml + ii, mh)
                If orientX = True Then
                    Dim sf As StringFormat = StringFormat.GenericTypographic
                    sf.FormatFlags = StringFormatFlags.DirectionVertical
                    If ii > mx Then
                        g.DrawString(CStr(chartdata(j, 0)), FontX, PenAxe.Brush, ml + ii + (ec / 200) - (FontX.GetHeight * 0.5), Fond.Height - mb + 5, sf)
                        mx = ii + FontX.GetHeight
                    End If
                Else
                    g.DrawString(CStr(chartdata(j, 0)), FontX, PenAxe.Brush, ml + ii + (ec / 200) - (FontX.GetHeight * 0.5 * (Len(chartdata(j, 0)) / 2)), Fond.Height - mb + 5)
                End If
                j = j + 1
            Next
            gg = g
        Catch ex As Exception

        End Try

    End Sub
    Private Sub desscourbe(ByVal g As Graphics)
        Dim i As Integer, j As Integer, xx As Integer, yy As Integer, xx0 As Integer, yy0 As Integer, tx As Integer, tx0 As Integer
        Try
            For i = 1 To chartdata.GetLength(1) - 1
                xx = ml * 100 + ex / 2
                yy = (Fond.Height - mb) - ((chartdata(0, i) - vmin) / ey) * ny
                PenCourbe(i).LineJoin = LineJoin.Round
                For j = 1 To chartdata.GetLength(0) - 1
                    xx0 = (xx + ex)
                    yy0 = (Fond.Height - mb) - ((chartdata(j, i) - vmin) / ey) * ny
                    tx = xx / 100
                    tx0 = xx0 / 100
                    If CourbeVisible(i) = True And ovisible = True Then g.DrawLine(Penombre, tx + 7, yy + 7, tx0 + 7, yy0 + 7)
                    If CourbeVisible(i) = True Then g.DrawLine(PenCourbe(i), tx, yy, tx0, yy0)
                    xx = xx0
                    yy = yy0
                Next
                xx = ml * 100 + ex / 2
                yy = (Fond.Height - mb) - ((chartdata(0, i) - vmin) / ey) * ny
                If pvisible = True Then
                    For j = 1 To chartdata.GetLength(0) - 1
                        xx0 = (xx + ex)
                        yy0 = (Fond.Height - mb) - ((chartdata(j, i) - vmin) / ey) * ny
                        tx = xx / 100
                        tx0 = xx0 / 100
                        Dim bo As Brush = Brushes.LightGray

                        If CourbeVisible(i) = True And ovisible = True Then g.FillPie(Penombre.Brush, tx - (PenCourbe(i).Width * 2) + 7, yy - (PenCourbe(i).Width * 2) + 7, PenCourbe(i).Width * 4, PenCourbe(i).Width * 4, 0, 360)
                        If CourbeVisible(i) = True Then g.FillPie(PenCourbe(i).Brush, tx - (PenCourbe(i).Width * 2), yy - (PenCourbe(i).Width * 2), PenCourbe(i).Width * 4, PenCourbe(i).Width * 4, 0, 360)
                        xx = xx0
                        yy = yy0
                    Next
                    tx = xx / 100
                    If CourbeVisible(i) = True And ovisible = True Then g.FillPie(Penombre.Brush, tx - (PenCourbe(i).Width * 2) + 7, yy - (PenCourbe(i).Width * 2) + 7, PenCourbe(i).Width * 4, PenCourbe(i).Width * 4, 0, 360)
                    If CourbeVisible(i) = True Then g.FillPie(PenCourbe(i).Brush, tx - (PenCourbe(i).Width * 2), yy - (PenCourbe(i).Width * 2), PenCourbe(i).Width * 4, PenCourbe(i).Width * 4, 0, 360)

                End If
            Next
        Catch ex As Exception

        End Try
    End Sub
    Private Sub dessinebar(ByVal g As Graphics)
        Dim i As Integer, j As Integer, v As Integer, xx As Integer, yy As Integer, tx As Integer, lb As Integer
        Try
            'calcule largeur bar
            j = 0
            For i = 1 To chartdata.GetLength(1) - 1
                If barVisible(i) = True Then j = j + 1
            Next
            lb = ex / j
            lb = lb / 100
            'dessine bar
            v = 0
            For i = 1 To chartdata.GetLength(1) - 1
                xx = ml * 100 + (lb * 100) * v
                If barVisible(i) = True Then v = v + 1
                ombre = Color.FromArgb(128, ombre.R, ombre.G, ombre.B)
                Penombre = New Pen(ombre, PenCourbe(i).Width)
                Penombre.StartCap = LineCap.Round
                Dim rbar As Rectangle
                For j = 0 To chartdata.GetLength(0) - 1
                    yy = (Fond.Height - mb) - (((chartdata(j, i) - vmin) / ey) * ny + 1)
                    tx = (xx / 100)
                    rbar = New Rectangle(tx, yy, lb / 2, Fond.Height - (yy + mb))
                    Dim tmpcolor As Color
                    tmpcolor = Color.FromArgb(64, PenCourbe(i).Color.R, PenCourbe(i).Color.G, PenCourbe(i).Color.B)
                    Dim tmpbrush = New LinearGradientBrush(rbar, PenCourbe(i).Color, tmpcolor, LinearGradientMode.Horizontal)
                    tmpbrush.WrapMode = 3
                    If barVisible(i) = True Then g.FillRectangle(tmpbrush, tx, yy, lb, Fond.Height - (yy + mb))
                    xx = xx + ex
                Next
            Next
        Catch ex As Exception

        End Try
    End Sub
    Private Sub dessinecurseur(ByVal g As Graphics)
        Dim i As Integer, j As Integer, xx As Integer, yy As Integer, xx0 As Integer, yy1 As Integer, tx As Integer, tx1 As Integer, xx1 As Integer
        Try
            'dessine curseur
            For i = 1 To chartdata.GetLength(1) - 1
                xx = ml * 100
                Dim rbar As Rectangle
                For j = 0 To chartdata.GetLength(0) - 1
                    yy = (Fond.Height - mb) - (((chartdata(j, i) - vmin) / ey) * ny + 1)
                    tx = (xx / 100)
                    xx0 = ex / 100
                    rbar = New Rectangle(tx, yy, xx0 / 2, 2)
                    Dim tmpcolor As Color
                    tmpcolor = Color.FromArgb(0, PenCourbe(i).Color.R, PenCourbe(i).Color.G, PenCourbe(i).Color.B)
                    Dim tmpbrush = New LinearGradientBrush(rbar, tmpcolor, PenCourbe(i).Color, LinearGradientMode.Horizontal)
                    tmpbrush.WrapMode = 3

                    If curseurVisible(i) = True Then g.FillRectangle(tmpbrush, tx, yy, xx0, 2)
                    rbar = New Rectangle(tx, yy, xx0 / 4, 2)
                    tmpbrush = New LinearGradientBrush(rbar, PenCourbe(i).Color, tmpcolor, LinearGradientMode.Horizontal)
                    tmpbrush.WrapMode = 3
                    xx1 = xx0 / 2
                    tx1 = tx + (xx0 / 4)
                    yy1 = yy - 1
                    tx = tx + (xx0 / 2)
                    If curseurVisible(i) = True Then g.FillRectangle(tmpbrush, tx1, yy1, xx1, 4)
                    If curseurVisible(i) = True And pvisible = True Then g.FillPie(PenCourbe(i).Brush, tx - 6, yy1 - 5, 12, 12, 0, 360)
                    xx = xx + ex
                Next
            Next
        Catch ex As Exception

        End Try
    End Sub
    Private Sub dessinemoyenne(ByVal g As Graphics)
        Dim i As Integer, j As Integer, yy As Integer, v As Integer, m As Double
        Try
            'dessine moyenne
            For i = 1 To chartdata.GetLength(1) - 1
                v = 0
                For j = 0 To chartdata.GetLength(0) - 1
                    v = v + (chartdata(j, i) - vmin)
                Next
                m = (v / chartdata.GetLength(0)) * 100
                moy(i) = m / 100
                yy = Fond.Height - ((m / ey) * ny / 100) - mb
                Dim tp As New Pen(Color.AliceBlue, 2)
                tp.Color = PenCourbe(i).Color
                tp.DashStyle = DashStyle.Dash
                If ValeurMoyenne(i) = True Then g.DrawLine(tp, ml, yy, Fond.Width - (ml), yy)
                tp.Dispose()
            Next
        Catch ex As Exception

        End Try
    End Sub

    Private Sub graph_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim i As Integer
        Try
            Fond.Top = 0
            Fond.Left = 0
            Fond.Height = Me.Height
            Fond.Width = Me.Width
            For i = 0 To 2
                PenCourbe(i) = New Pen(Color.Red, 3)
            Next
            Me.SetStyle(Windows.Forms.ControlStyles.ResizeRedraw, True)
        Catch ex As Exception

        End Try
    End Sub
    Private Sub Panel1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Fond.MouseDown
        Try
            If zoom = False Then Exit Sub
            If e.Button = Windows.Forms.MouseButtons.Left Then
                If Fond.Width > 4000 Then Exit Sub
                Fond.Dock = Windows.Forms.DockStyle.None
                Fond.Left = -(Math.Abs(Fond.Left) + e.X)
                Fond.Width = Fond.Width * 2
                If Fond.Width <= Me.Width Then Fond.Left = 0

            End If
            If e.Button = Windows.Forms.MouseButtons.Right Then
                If Fond.Width = Me.Width Then Exit Sub
                Fond.Dock = Windows.Forms.DockStyle.None
                Fond.Left = -(Math.Abs(Fond.Left) - e.X / 2)
                Fond.Width = Fond.Width / 2
                If Fond.Width <= Me.Width Then
                    Fond.Left = 0
                    Fond.Width = Me.Width
                End If
            End If
        Catch ex As Exception

        End Try
    End Sub

    Private Sub graph_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        Try
            Fond.Top = 0
            Fond.Left = 0
            Fond.Height = Me.Height
            Fond.Width = Me.Width
            Me.Refresh()
        Catch ex As Exception

        End Try

    End Sub

End Class


Le : 13/09/2007 14:53:26
Source : USER CONTROL GRAPHIQUE VB 2005
Ton code ressemble étrangement à celui de  nicolas99 posté en 2006, mis à part que t'as mis de l'ordre et remplacé le nom des variables par des noms plus cohérents...

J'ai trouvé comment afficher des données négatives:
Il faut utiliser la fonction MinVal() mais il faut la corriger car il y a une erreur:
"If OrdreCourbes.Count = 0 Then Return MaxVal()" c'est Return MinVal et pas MaxVal..
Tu crée une variable privée dans le module (perso j'ai crée vmin)
dans la fonction DessineGrille, tu apelles Minval (par exemple après avoir appelé Maxval) et tu sauve la valeur min dans la variable vmin.

Tu rajoutes ensuite ce vmin dans chaque calcul de graphe, il doit y avoir 5 ou 6 zones à modifier (dans dessinecourbe, dessinemoyenne, dessinebar...)
La zone de code exacte à modifier est celle où tu définis les valeur de Y en fonction de TempValeurs

Par exemple "yCourbe = Fond.Height - MargeBasse - (TempValeurs(0) / EchelleAxeY * PasDeDessinY)"
à chaque fois tu rajoutes -vmin, ce qui donne dans l'exemple précédent:
"yCourbe = Fond.Height - MargeBasse - ((TempValeurs(0)-vmin) / EchelleAxeY * PasDeDessinY)"

C'est pareil à chaque fois que tu as y = quelque chose fonction de TempValeur.


Je ne donne pas le module modifié puisque j'ai en fait utilisé le code initial de nicolas99 et le variables ne correspondent pas...





Le : 12/09/2007 16:43:43
Source : USER CONTROL GRAPHIQUE VB 2005
Est-il possible d'afficher des valeurs négatives??


Le : 10/09/2007 17:14:00
Source : USER CONTROL GRAPHIQUE VB 2005
Bonjour,

Chez moi ça ne marche pas, j'ai un message d'erreur au chargement du projet: "Could not find type 'Graphique.UcGraph'".

une solution peut-être??

Merci


Le : 24/08/2006 17:27:11
Source : ECRITURE & LECTURE EN MODE BINAIRE DANS UN FICHIER
Je confirme que ce n'est pas du fichier bianire ça, c'est facile à voir en ouvrant le fichier créé avec un éditeur de texte, ça n'a rien de binaire!

Lorsque tu fais un "Put #N° file, 1 octet, Caractère" c'est le code ascii de 'Caractère' qui est enregistré dans le fichier, et pas le caractère lui même. Pour faire réellement de l'enregistrement en binaire, il faut ajouter une ligne:
CaracterBin = chr(Caractere)
Comme ça VB va considérer que ton caratère est un code ascii et va réellement enregistrer ce que tu lui demande.

Et arrêtez de vous insulter, un code aussi simple n'en vaut pas la peine.


Le : 28/08/2003 10:16:02
Source : PLEIN D'OPÉRATIONS SIMPLE POUR GÉRER LES PROCESS
Es-tu sûr que ton code fonctionne sous Windows NT ?
Parce que j'ai essayer d'affecter à "handle" le n° d'ouverture du fichier directement et ça ne parche pas quand même.
L'application à fermer est un exécutable Vb, la racine est sous C:, j'ai donc essayé comme titres "test.exe", "C:test.exe", "test" ......
Là je comprend pas...


Le : 27/08/2003 17:41:36
Source : PLEIN D'OPÉRATIONS SIMPLE POUR GÉRER LES PROCESS
Bonjour,

Je veux pouvoir arrêter un exécutable à partir d'un programme VB,
je pense que la fonction "Fermer_app" que tu propose est la solution à mon problème. Mais je n'arrive pas à la faire fonctionner car la variable "handle" utilisée dans la fonction vaut toujours "0".
La chaîne de chacartères "Titre" est bien le nom de l'exécutable à fermer avec son arborescence complète ?

Par avance, merci de ton aide.



1


Nos sponsors

Sondage...

CalendriCode

Juillet 2009
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Comparez les prix Nouvelle version

Photothèque Nouveau !



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,218 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.