Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compile Exe
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg As Dword
%IDC_Graphic = 500 : %IDC_Timer = 501
Function PBMain() As Long
Dialog New Pixels, 0, "Parent",1100,300,600,375, %WS_OverlappedWindow To hDlg
Control Add Graphic, hDlg, %IDC_Graphic, "",0,0,600,375
Graphic Attach hDlg, %IDC_Graphic, ReDraw
Graphic Set Overlap %True
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Static RoundedValue As Long, rc1,rc2,rc3,rc4 As Rect
Select Case Cb.Msg
Case %WM_InitDialog
Roundedvalue = 75
rc1.nLeft = 30 : rc1.nTop = 50 : rc1.nBottom = 300 : rc1.nRight = 80 'w=50
rc2.nLeft = 150 : rc2.nTop = 50 : rc2.nBottom = 300 : rc2.nRight = 170 'w=20
rc3.nLeft = 220 : rc3.nTop = 50 : rc3.nBottom = 300 : rc3.nRight = 420 'w=200
rc4.nLeft = 450 : rc4.nTop = 50 : rc4.nBottom = 300 : rc4.nRight = 550 'w=100
SetTimer hDlg, %IDC_Timer, 50, 0
DrawTombstone rc4, RoundedValue
Graphic ReDraw
Case %WM_Timer
Graphic Clear
rc1.nTop +=1 : If rc1.nTop > rc1.nBottom Then rc1.nTop = 100
DrawTombstone rc1, RoundedValue
rc2.nTop +=1 : If rc2.nTop > rc2.nBottom Then rc2.nTop = 100
DrawTombstone rc2, RoundedValue
rc3.nTop +=1 : If rc3.nTop > rc3.nBottom Then rc3.nTop = 100
DrawTombstone rc3, RoundedValue
rc4.nTop +=1 : If rc4.nTop > rc4.nBottom Then rc4.nTop = 100
DrawTombstone rc4, RoundedValue
Graphic ReDraw
End Select
End Function
Sub DrawTombStone(rc As Rect, ByVal RoundedValue As Long)
Local gW,gH,w,f,r,h As Long
Graphic Get Client To gW,gH
w = rc.nRight - rc.nLeft + 1
h = rc.nBottom - rc.nTop + 1
R = w * RoundedValue / 200
If R > h Then R = h
Graphic Set Clip rc.nLeft, rc.nTop, gW-rc.nRight, gH-rc.nBottom
Graphic Scale (rc.nLeft,rc.nTop)-(rc.nRight,rc.nBottom)
Graphic Ellipse (rc.nLeft,rc.nTop)-(rc.nRight,rc.nTop+2*R),%Red, %Blue
Graphic Box (rc.nLeft,rc.nTop+R)-(rc.nRight,rc.nBottom),,%Red, %Blue
Graphic Line (rc.nLeft+1,rc.nTop+R)-(rc.nRight-1,rc.nTop+R), %Blue
Graphic Set Clip 0,0,0,0
End Sub
http://www.garybeene.com/sw/gbsnippets.htm