Analog Clock Component

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

Analog Clock Component

Postby Kambiz » March 23rd, 2009, 1:13 pm

I was looking for an Analog Clock component on the net couldn't find something nice. Therefore, I wrote one.

Clocks.png
Windows Sidebar's (and Component's) Clock Styles
Clocks.png (202.51 KiB) Viewed 11039 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.
Attachments
clock.zip
Analog Clock Demo
(634.05 KiB) Downloaded 1751 times
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Analog Clock Component

Postby w2m » March 23rd, 2009, 1:55 pm

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.
w2m
w2m
Senior Member
Senior Member
 
Posts: 76
Joined: March 8th, 2003, 7:11 pm
Location: New York, USA

Re: Analog Clock Component

Postby Kambiz » March 24th, 2009, 1:10 pm

I took a look at OVCClock component, but didn't find something useful.

The analog clock needs at least 5 semi-transparent PNG images:

  1. Clock face
  2. Hour hand
  3. Minute hand
  4. Second hand
  5. A pin when second hand is not showing
  6. Optional overlay glass
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Analog Clock Component

Postby kokkoras » March 25th, 2009, 12:00 am

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.
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Re: Analog Clock Component

Postby Kambiz » March 25th, 2009, 1:21 pm

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.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Analog Clock Component

Postby lucho6007 » May 15th, 2009, 11:20 pm

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!.
lucho6007
Member
Member
 
Posts: 2
Joined: October 30th, 2008, 4:48 pm

Re: Analog Clock Component

Postby Kambiz » May 16th, 2009, 10:01 am

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.
Attachments
AnalogClock.zip
Source Code of the TAnalogClock Component
(415.65 KiB) Downloaded 1555 times
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Analog Clock Component

Postby donalddukw » March 26th, 2011, 10:15 am

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
donalddukw
Member
Member
 
Posts: 1
Joined: March 26th, 2011, 10:11 am

Re: Analog Clock Component

Postby Kambiz » March 26th, 2011, 12:09 pm

The images are from Windows sidebar's clock gadget.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Analog Clock Component

Postby mabudaff » January 9th, 2012, 9:26 am

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 :)
mabudaff
Member
Member
 
Posts: 1
Joined: January 9th, 2012, 9:22 am

Re: Analog Clock Component

Postby Kambiz » February 3rd, 2012, 1:18 pm

This component needs GDI+. Have you installed the GDI+ Library properly?
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Analog Clock Component

Postby suhaimin » October 10th, 2012, 12:01 pm

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
suhaimin
Member
Member
 
Posts: 3
Joined: October 10th, 2012, 11:55 am

Re: Analog Clock Component

Postby suhaimin » October 11th, 2012, 11:40 pm

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
suhaimin
Member
Member
 
Posts: 3
Joined: October 10th, 2012, 11:55 am

Re: Analog Clock Component

Postby suhaimin » October 11th, 2012, 11:41 pm

watch hands can like any bmp or any other type picture
suhaimin
Member
Member
 
Posts: 3
Joined: October 10th, 2012, 11:55 am

Re: Analog Clock Component

Postby azrael11 » January 17th, 2013, 8:02 am

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 ...
azrael11
Member
Member
 
Posts: 2
Joined: January 17th, 2013, 7:52 am

Next

Return to DELPHI AREA Projects

Who is online

Users browsing this forum: Bing [Bot] and 34 guests

cron