导入IrisSkin2.dll
问题来了,如何添加皮肤包呢?
1.右键“工具箱”。“添加选项卡”,取名“皮肤”。
2.右键“皮肤”,“选择项”弹出对话框。
3.点击“浏览“,找到IrisSkin2.dll,这时你会发现 SkinEngine 的控件已经被打上勾 - 确定。
4.将 SkinEngine 控件添加到窗体上。
设置的界面:
后台代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace qianqianMisic
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
skinEngine1.SkinFile = @"D:\软件下载\皮肤控件\皮肤\Carlmness\Calmness.ssk";
}
int i = 0;
private void button1_Click(object sender, EventArgs e)
{
//把所有的皮肤文件全部读取出来
//获取皮肤文件夹中所有皮肤文件的全路径 存储到stylepath数组中
string[] stylepath = Directory.GetFiles(@"D:\软件下载\皮肤控件\skin");
//点击更换皮肤文其实就是去stylePath这样的组合中拿到一个皮肤文件的全路径 赋值给我们的skinFile
i++;//让皮肤发生改变
//表示我在最后一个皮肤文件有了一个皮肤
if (i==stylepath.Length)
{
i = 0;
}
skinEngine1.SkinFile = stylepath[i];
this.label1.Text= stylepath[i];
}
}
}
输出结果:
需要资源: