visor

Anuncio
frmPpal.txt
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
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
58
17/04/2005 10:50
Option Explicit
'-----------------------------------------------------------------------------Private Sub Combo1_Click()
File1.Pattern = Combo1.List(Combo1.ListIndex)
End Sub
'-----------------------------------------------------------------------------Private Sub Dir1_Change()
Dim Archivo As String
Dim Num As Integer
Dim sizeDir As Double
On Error GoTo quitarERROR
MousePointer = vbHourglass
File1.Path = Dir1.Path
Num = File1.ListCount
Label1.Caption = Format(Str(Num), "#,##0") & " archivos"
Num = File1.ListCount - 1
Do While Num > -1
Archivo = File1.Path + "\" + File1.List(Num)
sizeDir = sizeDir + FileLen(Archivo)
Num = Num - 1
Loop
sizeDir = Round(sizeDir / 1024, 0)
Label2.Caption = Format(Str(sizeDir), "#,##0") & " KB"
MousePointer = vbDefault
Exit Sub
quitarERROR:
Select Case Err.Number
Case 68
MsgBox "El dispositivo no está disponible", 16, "¡ERROR!"
Case Else
End Select
MousePointer = vbDefault
End Sub
'-----------------------------------------------------------------------------Private Sub Drive1_Change()
On Error GoTo quitarERROR
Dir1.Path = Drive1.Drive
Dir1.SetFocus
Exit Sub
quitarERROR:
Select Case Err.Number
Case 68
MsgBox "El dispositivo no está disponible", 16, "¡ERROR!"
Case Else
End Select
End Sub
Page 1 of 3
frmPpal.txt
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
120
120
120
120
120
120
120
120
120
120
120
120
120
120
17/04/2005 10:50
'-----------------------------------------------------------------------------Private Sub File1_Click()
'1 pixel = 26.458 twips aproximadamente para .gif, .jpg, , .wmf, .bmp, .dib, .ico
'1 pixel = 26.328 twips aproximadamente para .emf
Dim fName As String
Dim Alto As Integer, Ancho As Long
Dim areaAlto As Integer, areaAncho As Long
Dim Factor1 As Double, Factor2 As Double
Dim FactorSup As Double
On Error GoTo quitar_ERROR
MousePointer = vbHourglass
Picture1.Cls
fName = File1.Path + "\" + File1.FileName
Set Imagen = LoadPicture(fName)
Factor1 = (Imagen.Width / 4500)
Factor2 = (Imagen.Height / 4500)
If Factor1 > Factor2 Then
FactorSup = Factor1
Else
FactorSup = Factor2
End If
If Imagen.Width > 5000 And Imagen.Height > 5000 Then
Ancho = Imagen.Width / FactorSup
Alto = Imagen.Height / FactorSup
Picture1.PaintPicture Imagen, 2500 - Ancho / 2, 2500 - Alto / 2, Ancho, Alto
Else
Ancho = Imagen.Width
Alto = Imagen.Height
Picture1.PaintPicture Imagen, 2500 - Ancho / 4, 2500 - Alto / 4
End If
StatusBar1.Panels(1).Text = File1.FileName
StatusBar1.Panels(2).Text = Str(Round(Imagen.Width / 26.458, 0)) & " x" & Str(Rou
StatusBar1.Panels(3).Text = Str(Round(FileLen(fName) / 1024, 1)) & " KB"
StatusBar1.Panels(4).Text = Format(FileDateTime(fName), "dd/mm/yyyy")
DoEvents
MousePointer = vbDefault
Exit Sub
quitar_ERROR:
Beep
MousePointer = vbDefault
MsgBox "Archivo corrupto", 16, "¡ERROR!"
End Sub
'-----------------------------------------------------------------------------Private Sub Form_Activate()
Combo1.ListIndex = 0
Dir1_Change
End Sub
'-----------------------------------------------------------------------------Private Sub Form_Load()
Drive1.Drive = App.Path
End Sub
'-----------------------------------------------------------------------------Private Sub Picture1_DblClick()
frmVisor.Show 1
End Sub
Page 2 of 3
frmPpal.txt
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
17/04/2005 10:50
'-----------------------------------------------------------------------------Private Sub Timer1_Timer()
On Error GoTo quitarERROR
If File1.ListIndex > (File1.ListCount - 2) Then
Timer1.Interval = 0
File1.ListIndex = 0
Toolbar1.Buttons(2).Value = tbrUnpressed
Toolbar1.Buttons(2).Tag = 0
Toolbar1.Buttons(2).ToolTipText = " Show "
Else
File1.ListIndex = File1.ListIndex + 1
File1_Click
End If
Exit Sub
quitarERROR:
MsgBox "No hay archivos o no son compatibles", 16, "¡ERROR!"
End Sub
'-----------------------------------------------------------------------------Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
' Utiliza la propiedad Key con la instrucción
' SelectCase para especificar una acción.
On Error GoTo quitarERROR
Select Case Button.Key
Case Is = "Vista"
' Vista previa
frmVisor.Show 1
Case Is = "Show"
' Presenta imágenes en Show
If Toolbar1.Buttons(2).Tag = 1 Then
Timer1.Interval = 0
Toolbar1.Buttons(2).Tag = 0
Toolbar1.Buttons(2).ToolTipText = " Show "
Else
Timer1.Interval = 500
Toolbar1.Buttons(2).Tag = 1
Toolbar1.Buttons(2).ToolTipText = " Parar "
End If
Case Is = "Copiar"
' Copiar al portapapeles
Clipboard.Clear
Clipboard.SetData Imagen
Case Is = "Imprimir"
' Imprimir
If Imagen Is Nothing Then
MsgBox "No ha seleccionado ninguna imagen ", 16, "¡ERROR!"
Else
Printer.PaintPicture Imagen, 0, 0
Printer.EndDoc
End If
Case Is = "AcercaDe"
' Acerca de...
frmAcercaDe.Show 1
Case Is = "Salir"
' Salir del programa
End
End Select
Exit Sub
quitarERROR:
MsgBox "No hay archivos o no son compatibles", 16, "¡ERROR!"
End Sub
Page 3 of 3
Documentos relacionados
Descargar