Está en la página 1de 7

Curso de Visual Basic Aplicado

Harley Solano Snchez

Animacin de Imgenes
1. Ubquese en el formulario Fondo y defina las siguientes propiedades Height Left Top Width BackColor = 7020 = 2880 = 960 = 8895 = Blanco

H a r l e y S o l a n o * * H a r l e y S o l a n o * * H a r l e y S o l a n o

2. Insertar una etiqueta con las siguientes propiedades Nombre Aligment Caption Height Left Top Width BackColor Font = Label1 = center = Espere por Favor... Cargando el Sistema = 975 = 1440 = 3240 = 4335 = Blanco = MS Sans Serit en Negrita, Cursiva y de 18 Pts.

3. Insertar una etiqueta con las siguientes propiedades Nombre Aligment Caption Height Left Top Width BackColor Visible Font = Label2 = center = Importadora de Autos El Mejor = 1695 = 1200 =0 = 6015 = Blanco = False = Times New Roman en Negrita, Cursiva y de 36 Pts

4. Insertar una imagen con las siguientes propiedades Nombre Picture Stretch Height Left Top Width BackColor = Imagen2 = Busque el archivo Logo3.Jpg = True = 5295 = -7320 (Notar que es un nmero negativo) = 1680 = 8235 = Blanco

harley.solano@gmail.com

hasx1@hotmail.com

Curso de Visual Basic Aplicado

Harley Solano Snchez

5. Insertar un objeto Timer con las siguientes propiedades Nombre Interval Enabled = Timer1 =1 = True

H a r l e y S o l a n o * * H a r l e y S o l a n o * * H a r l e y S o l a n o

6. Insertar otro objeto Timer con las siguientes propiedades Nombre Interval Enabled = Timer2 =1 = False

7. Escribir las siguientes lineas de codigos Objeto : Formulario Fondo Evento : Load Cdigo : Private Sub Form_Load() Top = 30 Left = 2820 Height = 7460 Width = 9030 Image2.left = -7320 Menu.WindowState=2 End Sub

Objeto : Timer1 Evento : Timer Cdigo : Private Sub Timer1_Timer() Image2.Left = Image2.Left + 350 Label1.Left=Label1.Left + 300 If Image2.Left >= 2540 then Label1.Visible = False Label2.Visible = True Timer1.Enabled = False Timer2.Enabled = True Endif Fondo.AutoRedraw = False End Sub

harley.solano@gmail.com

hasx1@hotmail.com

Curso de Visual Basic Aplicado

Harley Solano Snchez

Objeto : Timer2 Evento : Time2 Cdigo : Private Sub Timer2_Timer() Image2.Left = Image2.Left - 350 If Image2.Left <= 240 then Timer2.Enabled = False Endif End Sub

H a r l e y S o l a n o * *

Animacin de Scroll Text (Marquesina Desplazndose)


1. Insertar un formulario al Proyecto, haga clic en Proyecto y Clic en Agregar formulario 2. Definir las siguientes propiedades al formulario Nombre = Derechos Top = 30 Left = 2820 Height = 7460 Width = 9030 BackColor = Blanco BorderStyle = None ControlBox = False MDIChild = True 3. Inserte una etiqueta con las siguientes propiedades Nombre = ScrollText AutoSize = True BackColor = Blanco Top = 0 Left = -14160 (Notar que es un nmero negativo) Height = 795 Width = 14370 Caption = Sistema de Control de Inventario Autolote El Mejor Font = Times New Roman, Negrita y Cursiva de 33 Pts 4. Insertar un Timer con las siguientes propiedades Nombre = Scroll Interval = 80 Enabled = True H a r l e y S o 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 Snchez

5. Insertar el siguiente codigo en el formulario Objeto : Timer Scroll Evento : Timer Cdigo : Private Sub Scroll_Timer() If (ScrollText.Left + ScrollText.Width) <= 0 Then ScrollText.Left = 8640 End If ScrollText.ForeColor = QBColor(Rnd * 10) ScrollText.Left = ScrollText.Left - 100 End Sub 6. Escribir el siguiente cdigo de programa en el formulario Fondo Objeto : Formulario Fondo Evento : Click Cdigo : Private Sub Form_Click() Derechos.Show End Sub

H a r l e y S o l a n o * * H a r l e y S o 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 Snchez

10

Animacin de Avanzada de Imgenes


Para esto seguiremos utilizando el formulario Derechos. 1. Insertar un Picture Box con las siguientes propiedades Nombre = PicScroll DrawStyle = Transparent ScaleMode = Pixel BackColor = Blanco BorderStyle = None Height = 1575 Left = 120 Top = 5400 Width = 6975 2. Escribir los siguientes cdigos de programas Objeto : Procedimientos Generales del Formulario Derechos Cdigo : Option Explicit Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long (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 Const DT_CENTER As Long = &H1 Const DT_EXPANDTABS As Long = &H40 Const DT_EXTERNALLEADING As Long = &H200 Const DT_LEFT As Long = &H0 Const DT_NOCLIP As Long = &H100 Const DT_NOPREFIX As Long = &H800 Const DT_RIGHT As Long = &H2 Const DT_SINGLELINE As Long = &H20 Const DT_TABSTOP As Long = &H80 Const DT_TOP As Long = &H0 Const DT_VCENTER As Long = &H4 Const DT_WORDBREAK As Long = &H10

H a r l e y S o l a n o * * H a r l e y S o 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 Snchez

11

Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Const ScrollText1 As String = "Sistema de Control de Inventario" & vbCrLf & _ vbCrLf & vbCrLf & _ "Propiedad Intelectual de : Harley Solano Snchez" & vbCrLf & _ "Versin : Has02-01-V Mayo - 2002" & _ vbCrLf & "Telfono (505) 077-85377 " & _ vbCrLf & "E - Mail : hasx1@hotmail.com" & _ vbCrLf & vbCrLf & _ "http://harley.sitio.net" & _ vbCrLf & _ "http://www.geocities.com/hasx1" Dim EndingFlag As Boolean

H a r l e y S o l a n o * * H a r l e y S o l a n o * * H a r l e y S o l a n o

Objeto : Formulario Derechos Evento : Activate Cdigo : Private Sub Form_Activate() RunMain PicScroll.ForeColor = &H80FF& PicScroll.FontSize = 16 End Sub

Tipo de Cdigo : FDU (Funcin Definida por el Usuario) Cdigo : Private Sub RunMain() Dim LastFrameTime As Long Const IntervalTime As Long = 40 Dim rt As Long Dim DrawingRect As RECT Dim UpperX As Long, UpperY As Long 'Upper left point of drawing rect Dim RectHeight As Long 'Mostrar el Formulario Derechos.Refresh

harley.solano@gmail.com

hasx1@hotmail.com

Curso de Visual Basic Aplicado

Harley Solano Snchez

12

Conseguir el tamao del rectngulo dibujado para indicada por la constante DT_CALCRECT rt = DrawText(PicScroll.hdc, ScrollText1, -1, DrawingRect, DT_CALCRECT) If rt = 0 Then 'err MsgBox "Error scrolling text", vbExclamation EndingFlag = True Else DrawingRect.Top = PicScroll.ScaleHeight DrawingRect.Left = 0 DrawingRect.Right = PicScroll.ScaleWidth Almacenar la altura del rectangulo RectHeight = DrawingRect.Bottom DrawingRect.Bottom = DrawingRect.Bottom + PicScroll.ScaleHeight End If Do While Not EndingFlag If GetTickCount() - LastFrameTime > IntervalTime Then PicScroll.Cls DrawText PicScroll.hdc, ScrollText1, -1, DrawingRect, DT_CENTER Or DT_WORDBREAK Actualizar las coordenadas dle rectangulo DrawingRect.Top = DrawingRect.Top - 1 DrawingRect.Bottom = DrawingRect.Bottom - 1 Controlando el desplazamiento y reinicializando si llego al final If DrawingRect.Top < -(RectHeight) Then 'tiempo Reset DrawingRect.Top = PicScroll.ScaleHeight DrawingRect.Bottom = RectHeight + PicScroll.ScaleHeight End If PicScroll.Refresh LastFrameTime = GetTickCount() End If DoEvents Loop Unload Me Set Derechos = Nothing End Sub Objeto : Formulario Derechos Evento : UnLoad Cdigo : Private Sub Form_Unload(Cancel As Integer) EndingFlag = True End Sub Objeto : Formulario Derechos Evento : Load Agregar al Cdigo las siguientes lneas : PicScroll.ForeColor = &H80FF& PicScroll.FontSize = 16

H a r l e y S o l a n o * * H a r l e y S o l a n o * * H a r l e y S o l a n o

harley.solano@gmail.com

hasx1@hotmail.com

También podría gustarte