VERSION 5.00
Begin VB.Form Zoom 
   BorderStyle     =   5  'Sizable ToolWindow
   Caption         =   "Zoom"
   ClientHeight    =   4050
   ClientLeft      =   45
   ClientTop       =   4635
   ClientWidth     =   4230
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   270
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   282
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Command1 
      Caption         =   "Undo"
      Height          =   252
      Left            =   3600
      TabIndex        =   3
      Top             =   0
      Width           =   588
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      DragMode        =   1  'Automatic
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   240
      Index           =   16
      Left            =   1872
      TabIndex        =   2
      Top             =   0
      Width           =   240
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Zoomed"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   192
      Left            =   0
      TabIndex        =   1
      Top             =   0
      Width           =   696
   End
   Begin VB.Label Label9 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "0 x 0"
      Height          =   192
      Left            =   960
      TabIndex        =   0
      Top             =   0
      Width           =   312
   End
   Begin VB.Image Image1 
      Height          =   3792
      Left            =   0
      Stretch         =   -1  'True
      Top             =   240
      Width           =   4176
   End
   Begin VB.Image Image2 
      Height          =   444
      Index           =   0
      Left            =   2592
      Top             =   3456
      Width           =   540
   End
   Begin VB.Image Image2 
      Height          =   444
      Index           =   1
      Left            =   3024
      Top             =   3456
      Width           =   540
   End
   Begin VB.Image Image2 
      Height          =   444
      Index           =   2
      Left            =   2784
      Top             =   3456
      Width           =   540
   End
End
Attribute VB_Name = "Zoom"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
Graphread.Menuundo_Click
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
activar KeyCode, Shift, Me
End Sub

Private Sub Form_Load()
Picture = Graphread.Picture
If Graphread.Picture2.Picture = 0 Then
    Zoom.Image1.Picture = LoadPicture()
Else
    SavePicture Graphread.Picture2.Picture, "tmpimage"
    Zoom.Image1.Picture = LoadPicture("tmpimage")
    If Len(Dir("tmpimage")) > 0 Then Kill "tmpimage"
End If
Image2(0).Left = 800
Image2(0).Top = 0
Image2(0).Picture = Picture

Image2(1).Left = 0
Image2(1).Top = 600
Image2(1).Picture = Picture

Image2(2).Left = 800
Image2(2).Top = 600
Image2(2).Picture = Picture
End Sub

Private Sub Form_Resize()
If Width < 2400 Then Width = 2400
If Height < 600 Then Height = 600
Image1.Width = ScaleWidth - 4
Image1.Height = IIf(ScaleHeight > 40, ScaleHeight - 20, 20)
Label4(16).Left = ScaleWidth * 2 / 3 - Label4(16).Width / 2
Command1.Left = ScaleWidth - Command1.Width
End Sub

Sub image1_DragDrop(Source As Control, x As Single, Y As Single)
If LCase(Source.Name) = "label4" Then Exit Sub
If Len(Source.Picture) = 0 Or Source.Picture = 0 Then
    Zoom.Image1.Picture = LoadPicture()
Else
    SavePicture Source.Picture, "tmpimage"
    Zoom.Image1.Picture = LoadPicture("tmpimage")
    If Len(Dir("tmpimage")) > 0 Then Kill "tmpimage"
End If
If LCase(Source.Name) = "picture2" Then graficomodificado = True
End Sub
Private Sub image1_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim contador5, contador6, color, color2, color3, color4
contador5 = Int(Graphread.Picture2.ScaleWidth * x / 12 / Zoom.Image1.Width)
contador6 = Int(Graphread.Picture2.ScaleHeight * Y / 12 / Zoom.Image1.Height)
color = Graphread.Picture2.Point(contador5, contador6)
Label9.Caption = contador5 & " , " & contador6
PictureTools.Label4(16).BackColor = IIf(color > -1, color, BackColor)
Zoom.Label4(16).BackColor = PictureTools.Label4(16).BackColor
color2 = color Mod 256
color3 = ((color - color2) / 256) Mod 256
color4 = (color - color2 - color3 * 256) / 256 / 256
PictureTools.Label13.Caption = IIf(color > -1, color2 & "/" & color3 & "/" & color4, "-1/-1/-1")
End Sub

Private Sub image1_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim cadena2 As String, contador5 As Integer, contador6 As Integer, color As Long
Dim contador7 As Integer, contador8 As Integer, coloractual As Long
If DebugVersion = 0 Then Exit Sub
contador5 = Int(Graphread.Picture2.ScaleWidth * x / 12 / Zoom.Image1.Width)
contador6 = Int(Graphread.Picture2.ScaleHeight * Y / 12 / Zoom.Image1.Height)
color = Graphread.Picture2.Point(contador5, contador6)
Label9.Caption = contador5 & " , " & contador6
undo False
Select Case Button
Case 1
    If PictureTools.Option1(0).Value Then    'draw
        For contador7 = contador5 - PictureTools.Shape1.Width + 2 To contador5
            For contador8 = contador6 - PictureTools.Shape1.Width + 2 To contador6
                Graphread.Picture2.PSet (contador7, contador8), colorpalette
            Next
        Next
    End If
    If PictureTools.Option1(1).Value And color <> colorpalette And color > -1 Then 'fill
        fill CInt(contador5), CInt(contador6), color, colorpalette, True
    End If
    If PictureTools.Option1(2).Value Then    'replace
        coloractual = Graphread.Picture2.Point(contador5, contador6)
        cadena2 = IIf(Shift = 0, "Actual color:" & coloractual & Chr(13), "")
        redefinecolor cadena2, coloractual, False
    End If
Case 2
    For contador7 = 0 To 15
        If colors(contador7) = color Then choosecolor CInt(contador7): Exit For
    Next
    Stop
    If contador7 = 16 Then
        coloractual = Graphread.Picture2.Point(contador5, contador6)
        cadena2 = IIf(Shift = 0, "Unknown color:" & coloractual & Chr(13), "")
        redefinecolor cadena2, coloractual, False
    End If
End Select
SavePicture Graphread.Picture2.Image, "tmpimage"
Graphread.Picture2.Picture = LoadPicture("tmpimage")
If Len(Dir("tmpimage")) > 0 Then Kill "tmpimage"

Zoom.image1_DragDrop Graphread.Picture2, 1, 1

End Sub

