The front-end was decadent for a while, so that yuerong, a friend from abroad, knew it ~ (I told her myself = _ = |), I was told by her that I had made a warm guarantee to her before the summer vacation .... what... so I have been busy writing Program , Hoping to win back the latest decadent time ~
This time I wrote an alert software. I wanted to capture a few images, but I couldn't find a free album with public links ~ So attach the download location of the Program (not Source code ).
Many of the functions used by the alarm software were not found in my book, including the controls used and some attributes.
Let's explain it one by one. I hope you will not be bored.
The first one is to draw the interface (Click here to preview the interface), I cut the Vista cat and CAT alarm clock as my program interface, so the irregular border program to be created this time, the compilation process is as follows:
1. Set formboderstyle to none, so that the border will not be seen, but there will be a gray program panel
2. Select the transparencykey attribute on the web to make it transparent.
3. Set backgroundimage to the Program Interface we created ~ My artist is really not so good. It took a few days to make such an interface.
The interface is finished. The second step is to add some widgets that I have never used before ..... the tools not mentioned in "C # Getting Started classic", such as numberupdown, timer, and sort y, are used here (only read this book and only read half of it ), the usage of these tools is as follows:Code There are still a lot of shards to be set up, especially those that cannot be found on the numberupdown Network (not found ).
Here I want to paste some code. I used the API function to play the wav file. I originally wanted to prompt the sound to be made using the WMP space. As a result, vs2005 C # Under Vista does not have the WMP control, I don't know if vs2005 has been removed, or if there is a compatibility problem in Vista (the vs2005 compatible patch has been installed), or wmp11 has not added the WMP control to vs2005. Even so, Microsoft wants to do this, without WMP, we use the API. The Code is as follows. Only wav files can be played. We recommend that you use sox_gui to convert a small WAV file for sound. Using System;
Using System. Collections. Generic;
Using System. componentmodel;
Using System. Data;
Using System. drawing;
Using System. text;
Using System. Windows. forms;
Using System. runtime. interopservices;
Namespace Api_playsound
{
Public Partial Class Form1: Form
{
Public Form1 ()
{
Initializecomponent ();
}
Internal Class Helpers
{
[Flags]
Public Enum Playsoundflags: Int
{
Snd_sync = Zero x 0000 , /**/ /*Play synchronously (default)*/ // Synchronization
Snd_async = Zero X 0001 , /**/ /*Play Asynchronously*/ // Asynchronous
Snd_nodefault = Zero X 0002 , /**/ /*Silence (! Default) if sound not found*/
Snd_memory = Zero X 0004 , /**/ /*Pszsound points to a memory file*/
Snd_loop = Zero X 0008 , /**/ /*Loop the sound until next sndplaysound*/
Snd_nostop = Zero X 0010 , /**/ /*Don't stop any currently playing sound*/
Snd_nowait = Zero X 00002000 , /**/ /*Don't wait if the driver is busy*/
Snd_alias = Zero X 00010000 , /**/ /*Name is a registry alias*/
Snd_alias_id = Zero X 00110000 , /**/ /*Alias is a predefined ID*/
Snd_filename = Zero X 00020000 , /**/ /*Name is file name*/
Snd_resource = Zero X 00040004 /**/ /*Name is Resource Name or atom*/
}
[Dllimport ( " Winmm " )]
Public Static Extern Bool Playsound ( String Szsound, intptr hmod, playsoundflags flags );
}
Private Void Btn_play_click ( Object Sender, eventargs E)
{
Helpers. playsound ("Start.wav", Intptr. Zero, helpers. playsoundflags. snd_async );
}
Private Void Btn_stop_click ( Object Sender, eventargs E)
{
Helpers. playsound (Null, Intptr. Zero, helpers. playsoundflags. snd_async );
}
}
}
(The above Code is reprinted and I have made minor changes myself)
You can also add using system. Io when writing it yourself, and then use fileinfo to check the existence of sound files.
Finally, add the program:
Http://cid-856b7a1fbf560755.skydrive.live.com/self.aspx/My%20free%20softwares/Ring.rar
Because of the Relationship Between music files, the program is relatively large, 1.67 m, XP and XP need to be supported by. NET Framework.