A função TelaDelay( .1 ) é só para simular um processamento qualquer ( skip )
O Label nn% vai centralizando conforme a barra anda, porque foi usado o style ss_center
Código: Selecionar todos
@ 10,10 CONTAINER oContainer ;
SIZE Thisform:nWidth - 20,20 ;
STYLE 2;
BACKCOLOR hwg_GetSysColor( COLOR_3DFACE ) ;
BACKSTYLE 2
@ 00,00 SAY oLabel CAPTION "" ;
OF oContainer ;
STYLE SS_CENTER ;
COLOR hwg_RGB(0, 0, 255)
ThisForm:oContainer:oLabel:Move( 1, 1, 0, 18)
nCol := ThisForm:oContainer:nLeft
nWidth := ThisForm:oContainer:nWidth //200 //ThisForm:oLabel:nWidth //ThisForm:nWidth
ThisForm:oContainer:oLabel:SetColor( Hwg_RGB( 0, 0, 255 ), hwg_RGB(255, 255, 0), .T. )
nTot := 100
FOR I:=1 TO nTot
nFinishCol := nCol + 1 + ( ( nWidth - 2 ) * i / nTot )
ThisForm:oContainer:oLabel:Move( 1, 1, nFinishCol-13, 18 )
ThisForm:oContainer:oLabel:SetText( Hb_NtoS ( Int( ( i / nTot ) * 100 ) ) + "%" )
TelaDelay( .1 )
NEXT
FUNCTION TelaDelay( nTime )
LOCAL iTime := Seconds()
DO WHILE Seconds() - iTime < nTime
hwg_DoEvents()
ENDDO
RETURN Nil

