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/*.


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.
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:
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.
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 veryeasy. Moreover, there are several articles on The Code Project whichexplain the LAYERED window. I cannot do better.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


聯(lián)系客服