Convertir source VB6 en VB2005

waspy59 Messages postés 189 Date d'inscription mercredi 24 novembre 2004 Statut Membre Dernière intervention 15 mai 2013 - 24 nov. 2007 à 15:15
waspy59 Messages postés 189 Date d'inscription mercredi 24 novembre 2004 Statut Membre Dernière intervention 15 mai 2013 - 24 nov. 2007 à 19:08
bonjour,

j'ai trouvé cette source en vb6 et je souhaite la convertir en VB2005 pour l'integrer a mon projet... seul hic je n'y arrive pas et idem avec l'outil de VB2005
Si qq1 peut m'aider
rq: picContainer et picZPLView sont des picturebox

Option Explicit
Public sngZPLZoom       As Single

Private Sub Form_Load()
    picZPLView.Cls
    sngZPLZoom = 6
    picZPLView.Width = (txtEtiquette(0).Text * sngZPLZoom) + &H2
    picZPLView.Height = (txtEtiquette(0).Text * sngZPLZoom) + &H6
    Call Form_Resize
  End Sub

Private Sub Form_Unload(Cancel As Integer)
    Unload frmPrincipal                                     ' DECHARGMENT DE LA FENETRE.
    Set frmPrincipal = Nothing                              ' RESTAURATION DE LA MEMOIRE.
    picZPLView.Cls
End Sub

Private Sub Form_Resize()
' DECLARATION DES VARIABLES.
    Dim lngX        As Long
    Dim lngY        As Long
    Dim lngI        As Long
    Dim lngJ        As Long
    Dim sngI        As Single

' POSITIONNEMENT DES OBJETS.
    If frmPrincipal.WindowState <> 1 Then
        lngX = frmPrincipal.Width / Screen.TwipsPerPixelX
        lngY = frmPrincipal.Height / Screen.TwipsPerPixelY
        picContainer.Width = lngX - 8
        picContainer.Height = lngY - 105

        picZPLView.Left = (picContainer.Width - picZPLView.Width) / 2
        picZPLView.Top = (picContainer.Height - picZPLView.Height) / 2

' AFFICHAGE DE LA REGLE DE GRANDEUR.
        picContainer.Cls
        picContainer.Line (picZPLView.Left, 0)-(picZPLView.Left, picContainer.Height), &H666666
        picContainer.Line ((picZPLView.Left + picZPLView.Width) - 1, 0)-((picZPLView.Left + picZPLView.Width) - 1, picContainer.Height), &H666666
        picContainer.Line (&H0, picZPLView.Top)-(picContainer.Width, picZPLView.Top), &H666666
        picContainer.Line (&H0, (picZPLView.Top + picZPLView.Height) - 1)-(picContainer.Width, (picZPLView.Top + picZPLView.Height) - 1), &H666666
        lngI = 0
        For sngI = ((picZPLView.Width) / txtEtiquette(0).Text) To picZPLView.Width - 1 Step ((picZPLView.Width) / txtEtiquette(0).Text)
            lngI = lngI + 1
            If lngI < 10 Then
                If lngI <> 5 Then
                    picContainer.Line (picZPLView.Left + sngI, picZPLView.Top - 4)-(picZPLView.Left + sngI, picZPLView.Top), &H880000
                    picContainer.Line (picZPLView.Left + sngI, (picZPLView.Top + picZPLView.Height))-(picZPLView.Left + sngI, (picZPLView.Top + picZPLView.Height) + 4), &H880000
                    Else
                        picContainer.Line (picZPLView.Left + sngI, picZPLView.Top - 8)-(picZPLView.Left + sngI, picZPLView.Top), &H880000
                        picContainer.Line (picZPLView.Left + sngI, (picZPLView.Top + picZPLView.Height))-(picZPLView.Left + sngI, (picZPLView.Top + picZPLView.Height) + 8), &H880000
                End If
                Else
                    lngI = 0
                    lngJ = lngJ + 10
                    picContainer.Line (picZPLView.Left + sngI, picZPLView.Top - 18)-(picZPLView.Left + sngI, picZPLView.Top), &H880000
                    picContainer.Line (picZPLView.Left + sngI, (picZPLView.Top + picZPLView.Height))-(picZPLView.Left + sngI, (picZPLView.Top + picZPLView.Height) + 18), &H880000
                    picContainer.CurrentX = ((picZPLView.Left + sngI) - (picContainer.TextWidth(lngJ) / 2)) - 4
                    picContainer.CurrentY = picZPLView.Top - 32
                    picContainer.ForeColor = 0
                    picContainer.Print lngJ
                    picContainer.CurrentX = ((picZPLView.Left + sngI) - (picContainer.TextWidth(lngJ) / 2)) - 4
                    picContainer.CurrentY = picZPLView.Top - 33
                    picContainer.ForeColor = &HFFFFFF
                    picContainer.Print lngJ
                    picContainer.CurrentX = ((picZPLView.Left + sngI) - (picContainer.TextWidth(lngJ) / &H2)) - &H4
                    picContainer.CurrentY = picZPLView.Top + picZPLView.Height + &H11
                    picContainer.ForeColor = 0
                    picContainer.Print lngJ
                    picContainer.CurrentX = ((picZPLView.Left + sngI) - (picContainer.TextWidth(lngJ) / &H2)) - &H5
                    picContainer.CurrentY = picZPLView.Top + picZPLView.Height + &H10
                    picContainer.ForeColor = &HFFFFFF
                    picContainer.Print lngJ
            End If
        Next sngI
        lngI = 0
        lngJ = 0
        For sngI = ((picZPLView.Height) / txtEtiquette(1).Text) To picZPLView.Height - &H1 Step ((picZPLView.Height) / txtEtiquette(1).Text)
            lngI = lngI + 1
            If lngI < 10 Then
                If lngI <> 5 Then
                    picContainer.Line (picZPLView.Left - 4, picZPLView.Top + sngI)-(picZPLView.Left, picZPLView.Top + sngI), &H880000
                    picContainer.Line ((picZPLView.Left + picZPLView.Width), picZPLView.Top + sngI)-((picZPLView.Left + picZPLView.Width) + &H4, picZPLView.Top + sngI), &H880000
                    Else
                        picContainer.Line (picZPLView.Left - &H8, picZPLView.Top + sngI)-(picZPLView.Left, picZPLView.Top + sngI), &H880000
                        picContainer.Line ((picZPLView.Left + picZPLView.Width), picZPLView.Top + sngI)-((picZPLView.Left + picZPLView.Width) + &H8, picZPLView.Top + sngI), &H880000
                End If
                Else
                    lngI = &H0
                    lngJ = lngJ + 10
                    picContainer.Line (picZPLView.Left - 18, picZPLView.Top + sngI)-(picZPLView.Left, picZPLView.Top + sngI), &H880000
                    picContainer.Line ((picZPLView.Left + picZPLView.Width), picZPLView.Top + sngI)-((picZPLView.Left + picZPLView.Width) + 18, picZPLView.Top + sngI), &H880000
                    picContainer.CurrentX = picZPLView.Left - (picContainer.TextWidth(lngJ) + &H1A)
                    picContainer.CurrentY = ((picZPLView.Top + sngI) - (picContainer.TextHeight(lngJ) / &H2))
                    picContainer.ForeColor = &H0
                    picContainer.Print lngJ
                    picContainer.CurrentX = picZPLView.Left - (picContainer.TextWidth(lngJ) + &H1B)
                    picContainer.CurrentY = ((picZPLView.Top + sngI) - (picContainer.TextHeight(lngJ) / &H2)) - &H1
                    picContainer.ForeColor = &HFFFFFF
                    picContainer.Print lngJ
                    picContainer.CurrentX = (picZPLView.Left + picZPLView.Width) + 18
                    picContainer.CurrentY = ((picZPLView.Top + sngI) - (picContainer.TextHeight(lngJ) / &H2))
                    picContainer.ForeColor = &H0
                    picContainer.Print lngJ
                    picContainer.CurrentX = (picZPLView.Left + picZPLView.Width) + &H11
                    picContainer.CurrentY = ((picZPLView.Top + sngI) - (picContainer.TextHeight(lngJ) / &H2)) - &H1
                    picContainer.ForeColor = &HFFFFFF
                    picContainer.Print lngJ
            End If
        Next sngI
    End If

End Sub

Private Sub cmdAction_Click(Index As Integer)
    Select Case Index
        Case &H2:    
                        sngZPLZoom = 6.2
                        picZPLView.Cls
                        picZPLView.Width = (txtEtiquette(&H0).Text * sngZPLZoom) + &H2
                        picZPLView.Height = (txtEtiquette(&H1).Text * sngZPLZoom) + &H6
                        Call Form_Resize
        Case &H3:
                        If sngZPLZoom < 10 Then
                            sngZPLZoom = sngZPLZoom + 0.2
                            picZPLView.Cls
                            picZPLView.Width = (txtEtiquette(&H0).Text * sngZPLZoom) + &H2
                            picZPLView.Height = (txtEtiquette(&H1).Text * sngZPLZoom) + &H6
                            Call Form_Resize
                        End If
        Case &H4:
                        If sngZPLZoom > 2.4 Then
                            sngZPLZoom = sngZPLZoom - 0.2
                            picZPLView.Cls
                            picZPLView.Width = (txtEtiquette(&H0).Text * sngZPLZoom) + &H2
                            picZPLView.Height = (txtEtiquette(&H1).Text * sngZPLZoom) + &H6
                            Call Form_Resize
                        End If
    End Select
End Sub

2 réponses

cs_Jack Messages postés 14006 Date d'inscription samedi 29 décembre 2001 Statut Modérateur Dernière intervention 28 août 2015 79
24 nov. 2007 à 16:13
Salut
Et ... quel est ton problème précis ?
Sur quoi bloques-tu ?
Outils : http://msdn2.microsoft.com/fr-fr/vbrun/ms789135.aspx
Exemples : http://www.microsoft.com/downloads/details.aspx?familyid=ef463b3a-ef97-454d-839e-7668c1113022&displaylang=en
FAQ : http://support.microsoft.com/default.aspx?scid=fh;fr;vbfaqupg&product=vbbfra

Vala
Jack, MVP VB
NB : Je ne répondrai pas aux messages privés

<hr />Le savoir est la seule matière qui s'accroit quand on la partage (Socrate)
0
waspy59 Messages postés 189 Date d'inscription mercredi 24 novembre 2004 Statut Membre Dernière intervention 15 mai 2013
24 nov. 2007 à 19:08
et bien je bloque sur la transformation en vb2005 pour les:
.currentX
.currentY
.print
.cls

je sais qu'il faut passer par ce genre de chose:

Public picContainer As System.Drawing.Bitmap
 Public f As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(picContainer)

et avec f.drawline pour tracer des traits ect.... mais quand j'essai mon resultat n'est pas fonctionnel :-(
0
Rejoignez-nous