ObjReader Community
Tips & Tricks => Take the control of your window => Topic started by: Patrice Terrier on February 09, 2020, 04:48:42 pm
-
This new SkinBox project uses the latest skin engine: zSkin.inc.
Bonus: I have added a new Clock control using the VISTA look (zClockCtrl).
The clock itself is available in 2-size: smallclock.png and largeclock.png in the Resource folder
(http://www.zapsolution.com/pictures/sdk/SkinBox.jpg)
See attached zip file: SkinBox.zip
...
-
To have a clock even more realistic, you can add drop shadow under the hands like this:
'// Draw the hour hand
IF nHH > 12 THEN nHH = nHH - 12
nAngle = (nHH * 30 - 90) + 30 * nMM \ 60
X = CenterX + (COS(nAngle * Pi180) * (CenterX - (imgW \ 4)))
Y = CenterY + (SIN(nAngle * Pi180) * (CenterY - (imgW \ 4)))
CALL DrawLine(graphics, CenterX+2, CenterY+2, X+2, Y+2, &H40000000, (imgW \ 40))
CALL DrawLine(graphics, CenterX, CenterY, X, Y, ARGB1, (imgW \ 40))
'// Draw the minute hand
nAngle = (nMM * 6 - 90) + 6 * nSS \ 60
X = CenterX + (COS(nAngle * Pi180) * (CenterX - (imgW \ 5)))
Y = CenterY + (SIN(nAngle * Pi180) * (CenterY - (imgW \ 5)))
CALL DrawLine(graphics, CenterX+2, CenterY+2, X+2, Y+2, &H40000000, (imgW \ 40))
CALL DrawLine(graphics, CenterX, CenterY, X, Y, ARGB1, (imgW \ 40))
'// Draw the second hand
nAngle = (nSS * 6 - 90)
X = CenterX + (COS(nAngle * Pi180) * (CenterX - (imgW \ 6)))
Y = CenterY + (SIN(nAngle * Pi180) * (CenterY - (imgW \ 6)))
CALL DrawLine(graphics, CenterX+2, CenterY+2, X+2, Y+2, &H40000000, (imgW \ 50))
CALL DrawLine(graphics, CenterX, CenterY, X, Y, ARGB2, (imgW \ 50))
nAngle = (nSS * 6 - 270)
X = CenterX + (COS(nAngle * Pi180) * (imgW \ 8 ))
Y = CenterY + (SIN(nAngle * Pi180) * (imgW \ 8 ))
CALL DrawLine(graphics, CenterX+2, CenterY+2, X+2, Y+2, &H40000000, (imgW \ 50))
CALL DrawLine(graphics, CenterX, CenterY, X, Y, ARGB2, (imgW \ 50))
'// Draw the center of the clock
CALL DrawEllipseFilled(graphics, CenterX - 1, CenterY - 1, 6, 6, &H40000000)
CALL DrawEllipseFilled(graphics, CenterX - 3, CenterY - 3, 6, 6, &HFFFF0000)
try it also with the "LargeClock.png".
...