Page 1 of 2
Analog Clock Component

Posted:
March 23rd, 2009, 1:13 pm
by Kambiz
I was looking for an Analog Clock component on the net couldn't find something nice. Therefore, I wrote one.
- Windows Sidebar's (and Component's) Clock Styles
- Clocks.png (202.51 KiB) Viewed 9227 times
In other hand, I am not a Graphic Designer. Because of that I used Windows' Sidebar clock images to write the component. I think because of copyright issues we cannot use this component. But some freeware images will solve the problem.
The attachment is a demo of the component.
Re: Analog Clock Component

Posted:
March 23rd, 2009, 1:55 pm
by w2m
The old TurboPower Orpheus Component has a OVCClock component. A Delphi 2009 version is available here:
http://www.songbeamer.com/delphi/ Since the company is no longer is in business you might be able to use its clockface bitmaps.
Re: Analog Clock Component

Posted:
March 24th, 2009, 1:10 pm
by Kambiz
I took a look at OVCClock component, but didn't find something useful.
The analog clock needs at least 5 semi-transparent PNG images:
- Clock face
- Hour hand
- Minute hand
- Second hand
- A pin when second hand is not showing
- Optional overlay glass
Re: Analog Clock Component

Posted:
March 25th, 2009, 12:00 am
by kokkoras
In your demo, when you hide the seconds hand, the minutes hand shifts a bit. I guess you round the time but you should better just hide the seconds hand.
Re: Analog Clock Component

Posted:
March 25th, 2009, 1:21 pm
by Kambiz
I thought when somebody hides the second hand, he/she whats the control consumes less CPU time. Because of that when ShowSeconds is False, the control updates every minute instead of every second.
Re: Analog Clock Component

Posted:
May 15th, 2009, 11:20 pm
by lucho6007
Can you publish the source code of the component?
I need an analog clock like that!
Thanks!
Sorry for my dummy English, I'm an Argentinian programmer and my native language is Spanish!.
Re: Analog Clock Component

Posted:
May 16th, 2009, 10:01 am
by Kambiz
I attached the source code of AnalogClock component. You need
GDI+ Library to install and use it.
Be aware of copyright issues regarding the clock faces. If you design your own clock faces, everything would be fine. Use a resource editor to get PNG image of the clock faces and hands.
Please do not distribute the code.
Re: Analog Clock Component

Posted:
March 26th, 2011, 10:15 am
by donalddukw
Hi,
Great post - thanks. I'd like to create this in Delphi XE.
Where did you get the images in the first post?
I'd like to create an application for my own use so copyright isn't an issue.
Cheers
Re: Analog Clock Component

Posted:
March 26th, 2011, 12:09 pm
by Kambiz
The images are from Windows sidebar's clock gadget.
Re: Analog Clock Component

Posted:
January 9th, 2012, 9:26 am
by mabudaff
Thank you for the component, TAnalogClock
I have tried with Delphi 7....
it installed successfully,...
but when I place it on the form ....It's makes exception
any help ... please

Re: Analog Clock Component

Posted:
February 3rd, 2012, 1:18 pm
by Kambiz
This component needs GDI+. Have you installed the
GDI+ Library properly?
Re: Analog Clock Component

Posted:
October 10th, 2012, 12:01 pm
by suhaimin
master, i dont understand how to rotate hour hand or minutehand with a bitmap/png file with delphi... can u show me a code in delphi program to do this? thanks
best wishes...
suhaimin
Re: Analog Clock Component

Posted:
October 11th, 2012, 11:40 pm
by suhaimin
is there a way to rotate objects, like watch hands, over a bmp or any other
type picture in delphi... can anyone to show me the code? thanks
Re: Analog Clock Component

Posted:
October 11th, 2012, 11:41 pm
by suhaimin
watch hands can like any bmp or any other type picture
Re: Analog Clock Component

Posted:
January 17th, 2013, 8:02 am
by azrael11
Hi ...
I found your componet and i use it to my project...
But i have a little problem...
First of all i create a Dynamic creation of your component
- Code: Select all
procedure AnalogClock_Comp(Location: TWinControl; NumOfComp: Integer; Left,Top,Height,Width: Integer; NewTime: TTime; Visible: Boolean);
Here is the full code...
- Code: Select all
procedure AnalogClock_Comp(Location: TWinControl; NumOfComp: Integer; Left,Top,Height,Width: Integer; NewTime: TTime; Visible: Boolean);
begin
MyAnalogClock := TAnalogClock.Create(Conf);
MyAnalogClock.Name := 'MyAnalogClock' + IntToStr(NumOfComp);
MyAnalogClock.Parent := Location;
MyAnalogClock.Left := Left;
MyAnalogClock.Top := Top;
MyAnalogClock.Height := Height;
MyAnalogClock.Width := Width;
MyAnalogClock.Style := acModern;
MyAnalogClock.Tag := NumOfComp;
MyAnalogClock.Visible := Visible;
MyAnalogClock.Active := True;
MyAnalogClock.Time := NewTime;
MyAnalogClock.Cursor := Arrow;
end;
Then i call it from my program like this...
- Code: Select all
AnalogClock_Comp(TsPanel(comp),num-1,5,10,50,60,Ctime[num - 1],True);
Now what is Ctime... "Countries Time"...
- Code: Select all
Ctime: array [0..9] of TTime;
and before i call the analogclock_comp i do this with the CTime...
- Code: Select all
Ctime[num - 1] := now;
CTime[num - 1] := IncHour(Ctime[num - 1],StrToInt(dtHour)); // dtHour is integer := 1;
CTime[num - 1] := IncHour(Ctime[num - 1],StrToInt('-'+dtMyTimeZone)); //dtMyTimeZone is integer := 2;
and then i put the Ctime in AnalogClock_Comp... but the time i get is my system time ... so ...
What am i doing wrong...
Thank you ...