C # QQ-like skin-navigation to the Principles
Http://www.cnblogs.com/sufei/archive/2010/03/10/1682847.html
C # imitation QQ skin-General level description (1)
Http://www.cnblogs.com/sufei/archive/2010/03/17/1688009.html
1. form skin
You don't need to say that the form skin is known as the form skin. Of course, it is also divided into forms and user controls, that is, from and usercontrol.
Here we implement the following forms and User Controls
1. Implementation of the Basic Form formbase and the basic user control formbase1
2. Implementation of the base form functionformbase
3. Main form mainform and main implementation
4. Implementation of the form entryform and the user control enterusercontrol
5. Implementation of skin control form skinform
6. Implementation of WINDOWS Message prompt Box form messageboxform
7. Implementation of Common User Controls enterfrom1 and form entryform
The red is what we said last time. Let's go down,
Fourth, form entryform and user control enterusercontrol
The form entryform is a basic form. It is mainly used as a general form, that is, to add or delete a form, as long as it is displayed from the main form, it must be used, the enterusercontrol user control and entryform form have the same implementation, but one is a user control and the other is a form, and the user control is used to nest it into the main form, therefore, it is the most commonly used project.
Fifth, skin control form skinform
This form should be easy to understand, that is, the skin-changing form and color-changing version. We can choose 8 pre-designed colors, or we can allocate them by ourselves, there are only nine shading entries for everyone to choose.
Sixth, Windows message prompt Box form messageboxform
There are usually three types of images shown above
Prompt, question, error,
This design has been added with the built-in functions of the system. For example, you can change images, add controls, change the size of frames, and design font styles.
Let's take a look at the simple usage.
Code
// Succeeded
If (result = 0)
{
Messageboxform objm = new messageboxform ("sms sent successfully! "," Message ", messageboxicon. information );
Objm. showdialog ();
Parent_main.refreshform ();
Binger ();
}
// Failed
Else if (result =-1)
{
Messageboxform objm = new messageboxform ("An error occurred while sending the message! "," Message ", messageboxicon. Error );
Objm. showdialog ();
}
// Data update failed
Else if (result =-2)
{
Messageboxform objm = new messageboxform ("failed to send due to network problems! "," Message ", messageboxicon. information );
Objm. showdialog ();
}
// Authentication failed
Else if (result =-3)
{
Messageboxform objm = new messageboxform ("your account is not successful. Please confirm that you have logged on successfully! "," Message ", messageboxicon. information );
Objm. showdialog ();
}
// Insufficient balance
Else if (result =-4)
{
Messageboxform objm = new messageboxform ("Your account balance is insufficient. Please recharge your account! "," Message ", messageboxicon. information );
Objm. showdialog ();
}
For more details, refer to the following chapters.
Seventh common user controls enterfrom1 and form entryform
These two are derived from the user controls in section 4, mainly for convenience.
It is also very convenient to use. It is used in the same way as a common form. It is okay to add such a line of code.
Public partial class addcolumnadmini: CRD. winui. Forms. entryform
At this point, our form skin is exhausted,
Second category, control skin
These are some basic controls and are also the most commonly used ones. In specific articles, we will describe their implementation and usage methods.
This type of controls will not be described one by one, and everyone will often know what to do at a glance.
Let me briefly describe an implementation method.
This is the same method in general controls.
Code
Protected override void wndproc (ref message m)
{
Base. wndproc (ref m );
If (M. MSG = 0xf | M. MSG = 0x133)
{
Shared. resetbordercolor (M, this );
}
}
This method is used to solve the problems that the system's built-in controls do not mention. Some APIs are required, and everyone knows something like borders, scroll bars, and so on, ms does not mention existing style modification methods or attributes.
I implemented the message interception method in windows. First, after intercepting the message estimation, I drew what I wanted and overwritten the system with what I wanted, this method is basically used for implementation,
The APIs used here are described in specific controls.
Add some default or required custom styles to each constructor.
Code
Public Panel ()
: Base ()
{
This. setstyle (controlstyles. userpaint, true );
This. setstyle (controlstyles. allpaintinginwmpaint, true );
This. setstyle (controlstyles. doublebuffer, true );
This. setstyle (controlstyles. resizeredraw, true );
This. setstyle (controlstyles. supportstransparentbackcolor, true );
}
Let's just go here. I will not talk much about it, because these things are invisible. From the next section, we will implement the tangible code, and it may be a little more time-consuming.
If you have any Reprinted Information, please indicate the source. Thank you for your cooperation !!!