I am pretty new to delphi , and would like to start with something easy .
Could someone please show me an example how to make a Digital clock that will transfer the “time” ( hour , min , sec ) to a label ? Or something like that
I am pretty new to delphi , and would like to start with something
Share
Exercise 1
Drop a
TLabeland aTButtonon your form.Double-click the button, and write
Exercise 2
To get the time to update automatically, add a
TTimerto your form, and double-click it (you can remove the button if you like). Then writeThis code will run once a second (the default interval for a
TTimer, which is perfect for us, so we do not need to change it).Exercise 3
To make the clock more annoying, you can try this: in the interface of your form, add a private field called
FHighlight, like this:Now you can do
In order for this effect to work, you need to change one of the properties of the
TLabelcontrol (design-time). ChangeTransparenttofalse, using the Object Inspector, if it isn’t already.Update (Exercise 4)
Since Warren P thinks it is too boring with a plain
TLabel, this is how you can achieve a ‘true’ seven-segment digital clock:Playing with the GDI brushes: