C # change the form skin

Source: Internet
Author: User

Step 1

First, add the IrisSkin2.dll file [to the current project reference (solution Resource Manager-> current project-> reference-> right-click-> Add reference, find the IrisSkin2.dll File

The IrisSkin2.dll file is best placed in the current project \ bin \ Debug file. [if it is not put in Debug, it will not be wrong under normal circumstances. However, if you do not place the control after the test, the added control may be difficult to use, that is, you cannot drag it to the form. Therefore, it is best to put it under debug .]

Step 2

Then add the IrisSkin2.dll file to the toolbox of vc2005: Right-click the file and select an item (this will take some time) -> browse to find the IrisSkin2.dll file (the file is best placed in the current project \ bin \ Debug file) and press OK to add the control to the toolbox. drag the newly added SkinEngine control in the toolbox to the current project.

Step 3

Copy the skin. ssk file to the current project \ bin \ Debug file.

Step 4

Drag the skinEngine control and openFileDialog control to the form, and then call the. ssk skin file in the project.

Using System;
Using System. Collections. Generic;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Text;
Using System. Windows. Forms;

Namespace WindowsApplication1
{
Public partial class Form1: Form
{
Public Form1 ()
{
InitializeComponent ();


}

Private void Form1_Load (object sender, EventArgs e)
{
// This. skinEngine1.SkinFile = "C: \ Documents and Settings \ Administrator \ Desktop \ exercises WindowsApplication1 \ bin \ Debug \ Skins \ XPGreen. ssk ";



}

Private void button#click (object sender, EventArgs e)
{
OpenFileDialog1.Filter = "(*. ssk) | *. ssk | txt files (*. txt) | *. txt"; // file name Filter
OpenFileDialog1.FilterIndex = 1;
OpenFileDialog1.InitialDirectory = "C: \ Documents and Settings \ Administrator \ Desktop \ exercises WindowsApplication1 \ bin \ Debug \ Skins \"; // initial directory
OpenFileDialog1.RestoreDirectory = true;
OpenFileDialog1.FileName = "create folder ";
If (openFileDialog1.ShowDialog () = DialogResult. OK)
{
MessageBox. Show ("successfully changed skin ");
}

}

Private void openFileDialog1_FileOk (object sender, CancelEventArgs e)
{
String name = openFileDialog1.FileName. ToString ();
This. skinEngine1.SkinFile = "C: \ Documents and Settings \ Administrator \ Desktop \ exercises" + name; // open the skin path
}
}
}


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.