/**************************************************************************************************************
* *
* 1、添加DLL文件IrisSkin2.dll。右击工程---->添加--->现有项------>找到 IrisSkin2.dll------->确定 *
* 2、更改IrisSkin2.dll属性:把 生成操作 改为“嵌入的资源” *
* 3、添加命名空间的引用:右击项目中的 引用----->添加...---->浏览----->找到IrisSkin2.dll----->确定 *
* 4、添加一个类,把以下代码复制进去。 *
* 5、在程序中调用 *
* *
* using zhxl.TestFace *
* *
* AppFace2005.ShowFace(@"D:/C#/C#换肤2005/MSN/MSN.ssk");//直接调用文件换肤 *
* AppFace2005.ChangeSkin(); //更改皮肤,系统会自动弹出窗体让选择SSK文件 *
* AppFace2005.RemoveSkin(); //清除皮肤 *
* *
**************************************************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using Sunisoft.IrisSkin;
using System.Windows.Forms;
namespace zhxl.TestFace
{
class AppFace2005
{
public static Sunisoft.IrisSkin.SkinEngine skin = new SkinEngine();
/// <summary>
/// 显示皮肤
/// </summary>
/// <param name="sskFileName"></param>
public static void ShowFace(string sskFileName)
{
skin.SkinFile =sskFileName; //MP10.ssk是皮肤文件
skin.Active = true;
}
/// <summary>
/// 移除皮肤
/// </summary>
public static void RemoveSkin()
{
if (skin == null)
{
return;
}
else
{
skin.Active = false;
}
}
/// <summary>
/// 更改皮肤
/// </summary>
public static void ChangeSkin()
{
OpenFileDialog ofdlg = new OpenFileDialog();
ofdlg.Title = "切换皮肤--请选择皮肤文件";
ofdlg.FileName = "";
ofdlg.Filter = "皮肤文件(*.SSK)|*.ssk";
if (ofdlg.ShowDialog() == DialogResult.OK)
{ ShowFace(ofdlg.FileName); }
}
}
}
以下是应用
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using zhxl.TestFace;
namespace TestFace
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Form1_Load(object sender, EventArgs e)
{
AppFace2005.ShowFace(@"D:/C#/C#换肤2005/MSN/MSN.ssk");
}
private void 切换皮肤ToolStripMenuItem_Click(object sender, EventArgs e)
{
AppFace2005.ChangeSkin();
}
private void 清除皮肤ToolStripMenuItem_Click(object sender, EventArgs e)
{
AppFace2005.RemoveSkin();
}
private void 新建窗口ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
}
}
}
* *
* 1、添加DLL文件IrisSkin2.dll。右击工程---->添加--->现有项------>找到 IrisSkin2.dll------->确定 *
* 2、更改IrisSkin2.dll属性:把 生成操作 改为“嵌入的资源” *
* 3、添加命名空间的引用:右击项目中的 引用----->添加...---->浏览----->找到IrisSkin2.dll----->确定 *
* 4、添加一个类,把以下代码复制进去。 *
* 5、在程序中调用 *
* *
* using zhxl.TestFace *
* *
* AppFace2005.ShowFace(@"D:/C#/C#换肤2005/MSN/MSN.ssk");//直接调用文件换肤 *
* AppFace2005.ChangeSkin(); //更改皮肤,系统会自动弹出窗体让选择SSK文件 *
* AppFace2005.RemoveSkin(); //清除皮肤 *
* *
**************************************************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using Sunisoft.IrisSkin;
using System.Windows.Forms;
namespace zhxl.TestFace
{
class AppFace2005
{
public static Sunisoft.IrisSkin.SkinEngine skin = new SkinEngine();
/// <summary>
/// 显示皮肤
/// </summary>
/// <param name="sskFileName"></param>
public static void ShowFace(string sskFileName)
{
skin.SkinFile =sskFileName; //MP10.ssk是皮肤文件
skin.Active = true;
}
/// <summary>
/// 移除皮肤
/// </summary>
public static void RemoveSkin()
{
if (skin == null)
{
return;
}
else
{
skin.Active = false;
}
}
/// <summary>
/// 更改皮肤
/// </summary>
public static void ChangeSkin()
{
OpenFileDialog ofdlg = new OpenFileDialog();
ofdlg.Title = "切换皮肤--请选择皮肤文件";
ofdlg.FileName = "";
ofdlg.Filter = "皮肤文件(*.SSK)|*.ssk";
if (ofdlg.ShowDialog() == DialogResult.OK)
{ ShowFace(ofdlg.FileName); }
}
}
}
以下是应用
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using zhxl.TestFace;
namespace TestFace
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Form1_Load(object sender, EventArgs e)
{
AppFace2005.ShowFace(@"D:/C#/C#换肤2005/MSN/MSN.ssk");
}
private void 切换皮肤ToolStripMenuItem_Click(object sender, EventArgs e)
{
AppFace2005.ChangeSkin();
}
private void 清除皮肤ToolStripMenuItem_Click(object sender, EventArgs e)
{
AppFace2005.RemoveSkin();
}
private void 新建窗口ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
}
}
}