Hola a todos bueno encontre este code x el google, es un reloj analogico la cual tiene algunos efecto y se mueve al mover el puntero pero lo que yo queria si alguien me puede ayudar con sta duda que tengo es de como puedo imprimirlo al lado derecho superior para que quede estatico como el reloj del vista. gracias de antemano.
Solo necesita un Timer1.. Interval = 40 ;D
Dim Ymouse, Xmouse, dy(30), dx(30), Da(30), Mo(30)
Dim Split1, Day1, Year1, Todaysdate, h, m, D, s, Face, Speed, n, scrll
Dim Dsplit, HandHeight, Handwidth, HandX, HandY, Step, currStep
Dim Test, ClockHeight, ClockWidth, ClockFromMouseY, ClockFromMouseX
Dim Fcol, Mcol, Scol, Hcol, Dcol
Private Type FL
T(30) As Long
Le(30) As Long
End Type
Dim FL As FL
Private Type HL
T(30) As Long
Le(30) As Long
End Type
Dim HL As HL
Private Type SL
T(30) As Long
Le(30) As Long
End Type
Dim SL As SL
Private Type ML
T(30) As Long
Le(30) As Long
End Type
Dim ML As ML
Private Type DL
T(30) As Long
Le(30) As Long
End Type
Dim DL As DL
Const PI = 3.1415
Private Sub Form_Load()
Dcol = 150 '//color de la fecha.
Fcol = vbBlue '//color de la cara.
Scol = 0 '//color de los segundos.
Mcol = 0 '//color de los minutos.
Hcol = 0 '//horas de color.
ClockHeight = 600
ClockWidth = 600
ClockFromMouseY = 1200
ClockFromMouseX = 600
'//¡No altere nada abajo! ¡Las alineaciones serán perdidas!
Da(1) = "DOMINGO": Da(2) = "LUNES": Da(3) = "MARTES": Da(4) = "MIÉRCOLES"
Da(5) = "JUEVES": Da(6) = "VIERNES": Da(7) = "SÁBADO"
Mo(1) = "ENERO": Mo(2) = "FEBRERO": Mo(3) = "MARSO"
Mo(4) = "ABRIL": Mo(5) = "MAYO": Mo(6) = "JUNIO": Mo(7) = "JULIO"
Mo(8) = "AGOSTO": Mo(9) = "SEPTIEMBRE": Mo(10) = "OCTUBRE"
Mo(11) = "NOVIEMBRE": Mo(12) = "DICIEMBRE"
Day1 = Day(Now)
Year1 = Year(Now)
If (Year1 < 2000) Then Year1 = Year1 + 1900
Todaysdate = " " + Da(Weekday(Now)) + " " + Str(Day1) + " " + Mo(Month(Now)) + " " + Str(Year1)
D = Todaysdate
h = "..."
m = "...."
s = "....."
Face = "1 2 3 4 5 6 7 8 9 101112 "
Form1.Font = "Arial"
Form1.FontSize = 8
Speed = 0.6
n = Len(Face) - 2
Ymouse = 0
Xmouse = 0
scrll = 0
Split1 = 360 / n
Dsplit = 360 / Len(D)
HandHeight = ClockHeight / 4.5
Handwidth = ClockWidth / 4.5
HandY = -7
HandX = -2.5
scrll = 0 '2 * Altura Del Reloj
Step = 0.06
currStep = 0
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Ymouse = Y + ClockFromMouseY ':acontecimiento Y + reloj del ratón Y;
Xmouse = X + ClockFromMouseX ':acontecimiento X + reloj del ratón X;
End Sub
Private Sub Timer1_Timer()
dy(0) = dy(0) + (Ymouse - dy(0)) * Speed
dy(0) = Fix(dy(0))
dx(0) = dx(0) + (Xmouse - dx(0)) * Speed
dx(0) = Fix(dx(0))
For i = 1 To Len(D) - 1
dy(i) = dy(i) + (dy(i - 1) - dy(i)) * Speed
dy(i) = Fix(dy(i))
dx(i) = dx(i) + (dx(i - 1) - dx(i)) * Speed
dx(i) = Fix(dx(i))
Next i
secs = Second(Now)
sec = -1.57 + PI * secs / 30
Mins = Minute(Now)
Min = -1.57 + PI * Mins / 30
hr = Hour(Now)
hrs = -1.575 + PI * hr / 6 + PI * Int(Minute(Now)) / 360
For i = 0 To n - 2
FL.T(i) = dy(i) + ClockHeight * Sin(-1.0471 + i * Split1 * PI / 180) + scrll
FL.Le(i) = dx(i) + ClockWidth * Cos(-1.0471 + i * Split1 * PI / 180)
Next i
For i = 0 To Len(h) - 1
HL.T(i) = dy(i) + HandY + (i * HandHeight) * Sin(hrs) + scrll
HL.Le(i) = dx(i) + HandX + (i * Handwidth) * Cos(hrs)
Next i
For i = 0 To Len(m) - 1
ML.T(i) = dy(i) + HandY + (i * HandHeight) * Sin(Min) + scrll
ML.Le(i) = dx(i) + HandX + (i * Handwidth) * Cos(Min)
Next i
For i = 0 To Len(s) - 1
SL.T(i) = dy(i) + HandY + (i * HandHeight) * Sin(sec) + scrll
SL.Le(i) = dx(i) + HandX + (i * Handwidth) * Cos(sec)
Next i
For i = 0 To Len(D) - 1
DL.T(i) = dy(i) + ClockHeight * 1.5 * Sin(currStep + i * Dsplit * PI / 180) + scrll
DL.Le(i) = dx(i) + ClockWidth * 1.5 * Cos(currStep + i * Dsplit * PI / 180)
Next i
currStep = currStep - Step
P
End Sub
Private Function SP(ByVal ST As String, ByVal Nu As Integer, Optional K As Byte = 1) As String
SP = Mid(ST, Nu + 1, K)
End Function
Private Sub P()
Cls
With Form1
.FontBold = False
.ForeColor = Dcol
For i = 0 To Len(D) - 1
.CurrentY = DL.T(i)
.CurrentX = DL.Le(i)
Print SP(D, i)
Next i
.ForeColor = Fcol
For i = 0 To n - 1
.CurrentY = FL.T(i)
.CurrentX = FL.Le(i)
If (i = 18 Or i = 20 Or i = 22) Then
Print SP(Face, i, 2)
i = i + 1
Else
Print SP(Face, i, 1)
End If
Next i
.FontBold = True
.ForeColor = Scol
For i = 0 To Len(s) - 1
.CurrentY = SL.T(i)
.CurrentX = SL.Le(i)
Print SP(s, i)
Next i
.ForeColor = Mcol
For i = 0 To Len(m) - 1
.CurrentY = ML.T(i)
.CurrentX = ML.Le(i)
Print SP(m, i)
Next i
.ForeColor = Hcol
For i = 0 To Len(h) - 1
.CurrentY = HL.T(i)
.CurrentX = HL.Le(i)
Print SP(h, i)
Next i
End With
End Sub
Hola,muy bueno el reloj,para que te quede ahi arriba podes agregar esto en el load..
Ymouse = 1000
Xmouse = 1000
Me.Height = 2200
Me.Width = 2200
Me.Top = 0
Me.Left = Screen.Width - Me.Width
y sacale el evento mousemove entero...
saludos.
EXELENTE
nunca vi algo asi en vb, si en flash, muy bien eh
saludos
Espectacular esta! muy bueno si se adaptaria a toda la pantalla.
Se parece al cursor cuando entras a la web de utilisma...(mi vieja entra, no yo :¬¬)
Sancho.Mazorka :¬¬
copadooooo :P
felicitaciones a quien lo haya hecho (la idea la habia visto ya, pero en VB es todo un logro xD jaja)
Excelenteeeeeeee :xD