C# 2005 换肤软件IrisSkin2使用笔记。

 /**************************************************************************************************************
 *                                                                                                            *
 *     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();
        }
    }
}
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值