• 大小: 4.64MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-11
  • 语言: C#
  • 标签: winform  

资源简介

本人在给予vs2012 c#编写的一个简答的winform换肤方法,方便大家快速预览皮肤的样式,以便应用,不足之处还请多指正,谢谢~~~

资源截图

代码片段和文件信息

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.Windows.Forms;
using Sunisoft.IrisSkin;

namespace WinformSkinChange
{
    public partial class FrmMain : Form
    {
        SkinEngine skinEngine = new SkinEngine();
        public FrmMain()
        {
            InitializeComponent();
            string[] files = Directory.GetFiles(Path.Combine(Application.StartupPath “Skin“) “*.ssk“SearchOption.AllDirectories);
            int i = 0;
            if (i < files.Length)
            {
                for (int j = 0; j < (files.Length % 8 == 0 ? files.Length / 8 : (files.Length / 8)+1); j++)//如果皮肤文件数量不能被8整除则多循环一次
                {
                    int last = files.Length % 8;//定义皮肤总数不能被8整除,整除以后剩余的数量
                    if (i < (files.Length / 8) * 8)
                    {
                        for (int k = 0; k < 8; k++)
                        {
                            Button btn = new Button();
                            btn.Location = new Point(k * 124 + 13 j * 50 + 23);
                            btn.Width = 118;
                            btn.Height = 30;
                            string path = files[i];
                            string btnName = path.Substring(files[i].LastIndexOf(@“\“) + 1);
                            btn.Text = btnName;
                            btn.Click += (object sender EventArgs e) => { skinEngine.SkinAllForm = true; skinEngine.SkinFile = path; this.tsslSkinFile.Text = Path.Combine(Application.StartupPath btnName); };
                            this.Controls.Add(btn);
                            i++;
                        }
                    }
                    else
                    {
                        for (int l = 0; l < last; l++)
                        {
                            Button btn = new Button();
                            btn.Location = new Point(l * 124 + 13 j * 50 + 23);
                            btn.Width = 118;
                            btn.Height = 30;
                            string path = files[i];
                            string btnName = path.Substring(files[i].LastIndexOf(@“\“) + 1);
                            btn.Text = btnName;
                            btn.Click += (object sender EventArgs e) => { skinEngine.SkinAllForm = true; skinEngine.SkinFile = path; this.tsslSkinFile.Text = Path.Combine(Application.StartupPath btnName); };
                            this.Controls.Add(btn);
                            i++;
                        }
                    }
                }
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     516096  2015-09-25 09:29  WinForm换肤\WinformSkinChange\bin\Debug\IrisSkin2.dll

     文件      20139  2006-03-22 10:16  WinForm换肤\WinformSkinChange\bin\Debug\Skin\Calmness.ssk

     文件      20271  2006-03-22 10:16  WinForm换肤\WinformSkinChange\bin\Debug\Skin\CalmnessColor1.ssk

     文件      20208  2006-03-22 10:15  WinForm换肤\WinformSkinChange\bin\Debug\Skin\CalmnessColor2.ssk

     文件       5032  2006-04-04 15:20  WinForm换肤\WinformSkinChange\bin\Debug\Skin\DeepCyan.ssk

     文件       5037  2006-03-29 12:12  WinForm换肤\WinformSkinChange\bin\Debug\Skin\DeepGreen.ssk

     文件       4908  2006-03-29 12:12  WinForm换肤\WinformSkinChange\bin\Debug\Skin\DeepOrange.ssk

     文件      16021  2006-03-22 12:25  WinForm换肤\WinformSkinChange\bin\Debug\Skin\DiamondBlue.ssk

     文件      16669  2006-03-22 12:26  WinForm换肤\WinformSkinChange\bin\Debug\Skin\DiamondGreen.ssk

     文件      10439  2006-03-22 11:32  WinForm换肤\WinformSkinChange\bin\Debug\Skin\Eighteen.ssk

     文件      10382  2006-03-22 06:05  WinForm换肤\WinformSkinChange\bin\Debug\Skin\EighteenColor1.ssk

     文件       9746  2006-03-22 06:06  WinForm换肤\WinformSkinChange\bin\Debug\Skin\EighteenColor2.ssk

     文件      12666  2006-03-22 06:06  WinForm换肤\WinformSkinChange\bin\Debug\Skin\Emerald.ssk

     文件      12261  2006-03-22 06:07  WinForm换肤\WinformSkinChange\bin\Debug\Skin\EmeraldColor1.ssk

     文件      12360  2006-03-22 06:07  WinForm换肤\WinformSkinChange\bin\Debug\Skin\EmeraldColor2.ssk

     文件      11422  2006-03-22 06:08  WinForm换肤\WinformSkinChange\bin\Debug\Skin\EmeraldColor3.ssk

     文件      18859  2006-03-22 05:53  WinForm换肤\WinformSkinChange\bin\Debug\Skin\GlassBrown.ssk

     文件      16097  2006-03-22 05:55  WinForm换肤\WinformSkinChange\bin\Debug\Skin\GlassGreen.ssk

     文件      17010  2006-03-22 05:57  WinForm换肤\WinformSkinChange\bin\Debug\Skin\GlassOrange.ssk

     文件      18988  2006-03-22 05:55  WinForm换肤\WinformSkinChange\bin\Debug\Skin\Longhorn.ssk

     文件      15156  2006-03-22 05:55  WinForm换肤\WinformSkinChange\bin\Debug\Skin\MacOS.ssk

     文件      12477  2006-03-23 14:11  WinForm换肤\WinformSkinChange\bin\Debug\Skin\Midsummer.ssk

     文件      12542  2006-03-23 14:13  WinForm换肤\WinformSkinChange\bin\Debug\Skin\MidsummerColor1.ssk

     文件      12238  2006-03-23 14:14  WinForm换肤\WinformSkinChange\bin\Debug\Skin\MidsummerColor2.ssk

     文件      12127  2006-03-23 14:14  WinForm换肤\WinformSkinChange\bin\Debug\Skin\MidsummerColor3.ssk

     文件      15899  2006-03-22 05:55  WinForm换肤\WinformSkinChange\bin\Debug\Skin\MP10.ssk

     文件      16292  2006-03-22 05:55  WinForm换肤\WinformSkinChange\bin\Debug\Skin\MSN.ssk

     文件      16262  2006-03-22 12:32  WinForm换肤\WinformSkinChange\bin\Debug\Skin\OneBlue.ssk

     文件      14246  2006-03-22 12:32  WinForm换肤\WinformSkinChange\bin\Debug\Skin\OneCyan.ssk

     文件      14852  2006-03-22 12:32  WinForm换肤\WinformSkinChange\bin\Debug\Skin\OneGreen.ssk

............此处省略233个文件信息

评论

共有 条评论