by karinha » Fri Nov 24, 2006 11:41 am
//-> Original by c:\FWH27\SAMPLES\LEDDISP.PRG
#Include "FiveWin.Ch"
Static nGet
Static oBmp1, oBmp2, oBmp3, oBmp4, oBmp5
//----------------------------------------------------------------------------//
Function Velocimetro()
Local oDlg, oGet
nGet := 0
DEFINE DIALOG oDlg FROM 0, 0 TO 20, 60 ;
TITLE "Mostrando um Velocimetro/Cronômetro"
oDlg:lHelpIcon := .F.
//--------------------Área do DisPlay do Cronômetro------------------------
/* Cada dígito é de 34 x 48 */
/* Copie o "DisPlay.Bmp" de \FW..\BitMaps\ Para o Seu Diretório de Uso */
@ 002, 001 SAY 'Contador : ' OF oDlg
@ 000, 000 BITMAP oBmp1 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg
@ 000, 000 BITMAP oBmp2 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg
@ 000, 000 BITMAP oBmp3 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg
@ 000, 000 BITMAP oBmp4 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg
@ 000, 000 BITMAP oBmp5 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg
//-------------------------------------------------------------------------
oBmp1:nTop := 28
oBmp1:nLeft := 80
oBmp1:nBottom := 52
oBmp1:nRight := 97
oBmp2:nTop := 28
oBmp2:nLeft := 98
oBmp2:nBottom := 52
oBmp2:nRight := 115
oBmp3:nTop := 28
oBmp3:nLeft := 116
oBmp3:nBottom := 52
oBmp3:nRight := 133
oBmp4:nTop := 28
oBmp4:nLeft := 134
oBmp4:nBottom := 52
oBmp4:nRight := 151
oBmp5:nTop := 28
oBmp5:nLeft := 152
oBmp5:nBottom := 52
oBmp5:nRight := 169
//--------------------Área dos Say's---------------------------------------
@ 002, 030 SAY "Evandro 1 Minuto" OF oDlg
@ 2.5, 030 SAY "Tem 60 Segundos " OF oDlg
@ 004, 010 SAY "Use Sua Imaginação... Estás Trabalhando Com Horas..." OF oDlg
@ 005, 010 SAY "Vai Contar até 180 Milésimos de Secs = 3 Segundos. " OF oDlg
@ 006, 010 SAY "By João Santos - In FiveWin The Best! " OF oDlg
@ 007, 010 SAY "Todos os Direitos Reservados - 27/12/2003 " OF oDlg
//--------------------Área dos Botões--------------------------------------
@ 007, 002 BUTTON "&Aumentar" OF oDlg SIZE 40, 12 ;
ACTION ( nGet++, Por_Bmp( oBmp1, oBmp2, oBmp3, oBmp4, oBmp5, nGet ) )
@ 007, 010 BUTTON "&Diminuir" OF oDlg SIZE 40, 12 ;
ACTION ( nGet--, Por_Bmp( oBmp1, oBmp2, oBmp3, oBmp4, oBmp5, nGet ) )
@ 007, 018 BUTTON "&Executar" OF oDlg SIZE 40, 12 ;
ACTION Executar_Bmp()
@ 007, 026 BUTTON "&Saida" OF oDlg ;
ACTION ( oDlg:End ) CANCEL
ACTIVATE DIALOG oDlg CENTERED
EndDialog() // Fechar a Dialog
Return Nil
//----------------------------------------------------------------------------//
Function Executar_Bmp()
Local I
Local nSegundos
// 1 Hora = 3600 Segundos - ( 60 * 60 )
// 3 Segundos = 180 Milésimos de Segundos
// Fórmula Para Calculo de Horas, Minutos, Segundos, Etc... Ex. Simples
nSegundos := Seconds() + ( 3600 + 5 ) / 60 * 3 //( 3 = Qtde. de Segundos)
For I = 1 To ( nSegundos - Seconds() )
Por_Bmp( oBmp1, oBmp2, oBmp3, oBmp4, oBmp5, I )
SysRefresh()
Next I
Return Nil
//----------------------------------------------------------------------------//
Function Por_Bmp ( oBjeto1, oBjeto2, oBjeto3, oBjeto4, oBjeto5, nQuantidade )
Local cNum := SPACE( 5 )
Local nLen := 3
Local nDigito1 := 3
Local nDigito2 := 3
Local nDigito3 := 3
Local nDigito4 := 3
Local nDigito5 := 3
cNum := STR( nQuantidade )
nLen := LEN( cNum )
nDigito1 := VAL( SUBSTR( cNum, nLen - 4, 1 ) )
If nDigito1 = 0
oBjeto1:nX := -528 // 0 - (11 * 48)
Else
oBjeto1:nX := 0 - ( nDigito1 * 48 )
Endif
nDigito2 := VAL( SUBSTR( cNum, nLen - 3, 1 ) )
If nDigito2 = 0 .AND. nDigito1 = 0
oBjeto2:nX := -528
Else
oBjeto2:nX := 0 - ( nDigito2 * 48 )
Endif
nDigito3 := VAL( SUBSTR( cNum, nLen - 2, 1 ) )
If nDigito3 = 0 .AND. nDigito2 = 0 .AND. nDigito1 = 0
oBjeto3:nX := -528
Else
oBjeto3:nX := 0 - ( nDigito3 * 48 )
Endif
nDigito4 := VAL( SUBSTR( cNum, nLen - 1, 1 ) )
If nDigito4 = 0 .AND. nDigito3 = 0 .AND. nDigito2 = 0 .AND. nDigito1 = 0
oBjeto4:nX := -528
Else
oBjeto4:nX := 0 - ( nDigito4 * 48 )
Endif
nDigito5 := VAL( SUBSTR( cNum, nLen, 1 ) )
oBjeto5:nX := 0 - ( nDigito5 * 48 )
oBjeto5:Refresh( .F. )
oBjeto4:Refresh( .F. )
oBjeto3:Refresh( .F. )
oBjeto2:Refresh( .F. )
oBjeto1:Refresh( .F. )
SysRefresh()
Return Nil
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341