Você está na página 1de 7

Curso de Visual Basic Aplicado Harley Solano Sánchez 6

H
a
Animación de Imágenes r
l
1. Ubíquese en el formulario Fondo y defina las siguientes propiedades e
y
Height = 7020
Left = 2880 S
Top = 960 o
Width = 8895 l
BackColor = Blanco a
n
2. Insertar una etiqueta con las siguientes propiedades o

Nombre = Label1 *
Aligment = center *
Caption = Espere por Favor... Cargando el Sistema
Height = 975 H
Left = 1440 a
Top = 3240 r
Width = 4335 l
BackColor = Blanco e
Font = MS Sans Serit en Negrita, Cursiva y de 18 Pts. y

3. Insertar una etiqueta con las siguientes propiedades S


o
Nombre = Label2 l
Aligment = center a
Caption = Importadora de Autos “El Mejor” n
Height = 1695 o
Left = 1200
Top =0 *
Width = 6015 *
BackColor = Blanco
Visible = False H
Font = Times New Roman en Negrita, Cursiva y de 36 Pts a
r
4. Insertar una imagen con las siguientes propiedades l
e
Nombre = Imagen2 y
Picture = Busque el archivo Logo3.Jpg
Stretch = True S
Height = 5295 o
Left = -7320 (Notar que es un número negativo) l
Top = 1680 a
Width = 8235 n
BackColor = Blanco o

harley.solano@gmail.com hasx1@hotmail.com
Curso de Visual Basic Aplicado Harley Solano Sánchez 7
H
a
r
5. Insertar un objeto Timer con las siguientes propiedades l
e
Nombre = Timer1 y
Interval =1
Enabled = True S
o
6. Insertar otro objeto Timer con las siguientes propiedades l
a
Nombre = Timer2 n
Interval =1 o
Enabled = False
*
7. Escribir las siguientes lineas de codigos *

Objeto : Formulario Fondo H


a
Evento : Load r
l
Código : e
Private Sub Form_Load() y
Top = 30
Left = 2820 S
Height = 7460 o
Width = 9030 l
Image2.left = -7320 a
Menu.WindowState=2 n
End Sub o

*
Objeto : Timer1 *

Evento : Timer H
a
Código : r
Private Sub Timer1_Timer() l
Image2.Left = Image2.Left + 350 e
Label1.Left=Label1.Left + 300 y
If Image2.Left >= 2540 then
Label1.Visible = False S
Label2.Visible = True o
Timer1.Enabled = False l
Timer2.Enabled = True a
Endif n
Fondo.AutoRedraw = False o
End Sub

harley.solano@gmail.com hasx1@hotmail.com
Curso de Visual Basic Aplicado Harley Solano Sánchez 8
H
a
r
Objeto : Timer2 l
e
Evento : Time2 y

Código : S
Private Sub Timer2_Timer() o
Image2.Left = Image2.Left - 350 l
If Image2.Left <= 240 then a
Timer2.Enabled = False n
Endif o
End Sub
*
*
Animación de Scroll Text (Marquesina Desplazándose)
H
1. Insertar un formulario al Proyecto, haga clic en Proyecto y Clic en Agregar formulario a
r
2. Definir las siguientes propiedades al formulario l
e
Nombre = Derechos y
Top = 30
Left = 2820 S
Height = 7460 o
Width = 9030 l
BackColor = Blanco a
BorderStyle = None n
ControlBox = False o
MDIChild = True
*
3. Inserte una etiqueta con las siguientes propiedades *

Nombre = ScrollText H
AutoSize = True a
BackColor = Blanco r
Top = 0 l
Left = -14160 (Notar que es un número negativo) e
Height = 795 y
Width = 14370
Caption = Sistema de Control de Inventario – Autolote El Mejor S
Font = Times New Roman, Negrita y Cursiva de 33 Pts o
l
4. Insertar un Timer con las siguientes propiedades
a
Nombre = Scroll n
Interval = 80 o
Enabled = True

harley.solano@gmail.com hasx1@hotmail.com
Curso de Visual Basic Aplicado Harley Solano Sánchez 9
H
a
5. Insertar el siguiente codigo en el formulario r
l
Objeto : Timer Scroll e
y
Evento : Timer
S
Código : o
Private Sub Scroll_Timer() l
If (ScrollText.Left + ScrollText.Width) <= 0 Then a
ScrollText.Left = 8640 n
End If o
ScrollText.ForeColor = QBColor(Rnd * 10)
ScrollText.Left = ScrollText.Left - 100 *
End Sub *

6. Escribir el siguiente código de programa en el formulario Fondo H


a
Objeto : Formulario Fondo r
l
Evento : Click e
y
Código :
Private Sub Form_Click() S
Derechos.Show o
End Sub l
a
n
o

*
*

H
a
r
l
e
y

S
o
l
a
n
o

harley.solano@gmail.com hasx1@hotmail.com
Curso de Visual Basic Aplicado Harley Solano Sánchez 10
H
a
r
Animación de Avanzada de Imágenes l
e
Para esto seguiremos utilizando el formulario Derechos. y

1. Insertar un Picture Box con las siguientes propiedades S


o
Nombre = PicScroll l
DrawStyle = Transparent a
ScaleMode = Pixel n
BackColor = Blanco o
BorderStyle = None
Height = 1575 *
Left = 120 *
Top = 5400
Width = 6975 H
a
2. Escribir los siguientes códigos de programas r
l
Objeto : Procedimientos Generales del Formulario Derechos e
y
Código :
S
Option Explicit o
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, l
ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As a
Long n
o
(Las dos lineas anteriores van en una misma linea)
Private Declare Function GetTickCount Lib "kernel32" () As Long *
*
Const DT_BOTTOM As Long = &H8
Const DT_CALCRECT As Long = &H400 H
Const DT_CENTER As Long = &H1 a
Const DT_EXPANDTABS As Long = &H40 r
Const DT_EXTERNALLEADING As Long = &H200 l
Const DT_LEFT As Long = &H0 e
Const DT_NOCLIP As Long = &H100 y
Const DT_NOPREFIX As Long = &H800
Const DT_RIGHT As Long = &H2 S
Const DT_SINGLELINE As Long = &H20 o
Const DT_TABSTOP As Long = &H80 l
Const DT_TOP As Long = &H0 a
Const DT_VCENTER As Long = &H4 n
Const DT_WORDBREAK As Long = &H10 o

harley.solano@gmail.com hasx1@hotmail.com
Curso de Visual Basic Aplicado Harley Solano Sánchez 11
H
a
r
Private Type RECT l
Left As Long e
Top As Long y
Right As Long
Bottom As Long S
End Type o
l
Const ScrollText1 As String = "Sistema de Control de Inventario" & vbCrLf & _ a
vbCrLf & vbCrLf & _ n
"Propiedad Intelectual de : Harley Solano Sánchez" & vbCrLf & _ o
"Versión : Has02-01-V Mayo - 2002" & _
vbCrLf & "Teléfono (505) 077-85377 " & _ *
vbCrLf & "E - Mail : hasx1@hotmail.com" & _ *
vbCrLf & vbCrLf & _
"http://harley.sitio.net" & _ H
vbCrLf & _ a
"http://www.geocities.com/hasx1" r
l
Dim EndingFlag As Boolean e
y

Objeto : Formulario Derechos S


o
Evento : Activate l
a
Código : n
Private Sub Form_Activate() o
RunMain
PicScroll.ForeColor = &H80FF& *
PicScroll.FontSize = 16 *
End Sub
H
a
Tipo de Código : FDU (Función Definida por el Usuario) r
l
Código : e
Private Sub RunMain() y
Dim LastFrameTime As Long
Const IntervalTime As Long = 40 S
Dim rt As Long o
Dim DrawingRect As RECT l
Dim UpperX As Long, UpperY As Long 'Upper left point of drawing rect a
Dim RectHeight As Long n
'Mostrar el Formulario o
Derechos.Refresh

harley.solano@gmail.com hasx1@hotmail.com
Curso de Visual Basic Aplicado Harley Solano Sánchez 12
H
a
‘Conseguir el tamaño del rectángulo dibujado para indicada por la constante DT_CALCRECT r
rt = DrawText(PicScroll.hdc, ScrollText1, -1, DrawingRect, DT_CALCRECT) l
If rt = 0 Then 'err e
MsgBox "Error scrolling text", vbExclamation y
EndingFlag = True
Else S
DrawingRect.Top = PicScroll.ScaleHeight o
DrawingRect.Left = 0 l
DrawingRect.Right = PicScroll.ScaleWidth a
‘Almacenar la altura del rectangulo n
RectHeight = DrawingRect.Bottom o
DrawingRect.Bottom = DrawingRect.Bottom + PicScroll.ScaleHeight
End If *
Do While Not EndingFlag *
If GetTickCount() - LastFrameTime > IntervalTime Then
PicScroll.Cls H
DrawText PicScroll.hdc, ScrollText1, -1, DrawingRect, DT_CENTER Or DT_WORDBREAK a
‘ Actualizar las coordenadas dle rectangulo r
DrawingRect.Top = DrawingRect.Top - 1 l
DrawingRect.Bottom = DrawingRect.Bottom - 1 e
‘ Controlando el desplazamiento y reinicializando si llego al final y
If DrawingRect.Top < -(RectHeight) Then 'tiempo Reset
DrawingRect.Top = PicScroll.ScaleHeight S
DrawingRect.Bottom = RectHeight + PicScroll.ScaleHeight o
End If l
PicScroll.Refresh a
LastFrameTime = GetTickCount() n
End If o
DoEvents
Loop *
Unload Me *
Set Derechos = Nothing
End Sub H
a
Objeto : Formulario Derechos r
Evento : UnLoad l
Código : e
Private Sub Form_Unload(Cancel As Integer) y
EndingFlag = True
End Sub S
o
Objeto : Formulario Derechos l
Evento : Load a
Agregar al Código las siguientes líneas : n
o
PicScroll.ForeColor = &H80FF&
PicScroll.FontSize = 16

harley.solano@gmail.com hasx1@hotmail.com

Você também pode gostar