Click here to Skip to main content
Licence CPOL
First Posted 4 Nov 2008
Views 18,958
Downloads 1,774
Bookmarked 53 times

Yet Another Transparent Clock which Supports Custom Skin

By | 4 Nov 2008 | Article
A clock, with transparent background, supports add custom skins

Introduction

I created this tiny clock program, which supports custom skins, for my brother.

Anyone who wants to add a new skin can create a skin directory in /Theme/*.

1.jpg

2.jpg

Background

The code is written based upon Windows layered window and GDI+.

In the source code, you will find the GDIPluszH.h file which is provided here and also the CXml classes which are provided here.

How to Add a New Skin

Each type of skin is placed under the /Theme/ directory.
To add a new skin, just create another sub-directory in /Theme/, which includes the image files and configuration file.

The image files are:

  • dial.png
  • hourNeedle.png
  • minuteNeedle.png
  • secondNeedle.png

And the configuration file  is setting.xml.

There is a sample for the setting.xml:

<?xml version="1.0" encoding="UTF-8"?>
<skin>
	<dial>
		<filename>dial.png</filename>
		<centerX>200</centerX>
		<centerY>206</centerY>
	</dial>

	<hourNeedle>
		<filename>hourNeedle.png</filename>
		<centerX>14</centerX>
		<centerY>176</centerY>
	</hourNeedle>

	<minuteNeedle>
		<filename>minuteNeedle.png</filename>
		<centerX>14</centerX>
		<centerY>176</centerY>
	</minuteNeedle>

	<secondNeedle>
		<filename>secondNeedle.png</filename>
		<centerX>14</centerX>
		<centerY>194</centerY>
	</secondNeedle>
</skin>

The configuration file indicates the rotate center points of the dial and the needles.

Others

You can download the source code from the link at the top of this article.

There is no need to explain more about the code because it is very easy. Moreover, there are several articles on The Code Project which explain the LAYERED window. I cannot do better.

History

  • 5th November, 2008: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Jerry.Wang

Architect
Best Brain
China China

Member

Jerry is working for the Best Brain ChangSha Office, China. He has been being interested in computer programing from his childhood. Skilled in Windows/Linux C++, Mac OS Objective-C, .Net & C#, ASP.Net, AS3/JS/PHP etc.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionHow to add a button or an edit box to modify the date or display date PinmemberSam.Liang19:59 19 Feb '12  
GeneralFirst Link Is error Pinmemberkmlch14:45 5 Nov '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 5 Nov 2008
Article Copyright 2008 by Jerry.Wang
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid