• 步入DevExpress的使用(VS)


    1、下载安装DevExpress控件(如DXperienceUniversal-11.1.12.exe),安装后路径:“C:Program Files (x86)DevExpress 2011.1”。

    2、找到安装后DevExpress控件的DLL(要使用的DLL),路径是“C:Program Files (x86)DevExpress 2011.1ComponentsSourcesDevExpress.DLL”,拷贝到自己需要的地方,以方便项目添加引用时通过“浏览”找到;不拷贝也可以,项目引用时选择“项目集”>>“扩展”下找到。

    3、在界面的“工具箱”中,添加一选项卡,命名如:“DevExpress”,并右击“选择项”,在.Net Framework组件中找到需要的控件名(可按控件的首字符查找),如:“DefaultLookAndFeel”,然后添加对应的DLL,如“DevExpress.Utils.v11.1.dll”(若自动添加也可以不添加)。

    4、向对话框中添加:DefaultLookAndFeel、ComboBoxEdit控件等

    5、实现的具体代码如下:

    (1)Program.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    
    namespace TestExpressSkins
    {
        static class Program
        {
            /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main()
            {
                DevExpress.UserSkins.BonusSkins.Register();
                DevExpress.UserSkins.OfficeSkins.Register();
                DevExpress.Skins.SkinManager.EnableFormSkins();
                
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }
        }
    }
    

    (2)Form1.cs

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace TestExpressSkins
    {
        public partial class Form1 : DevExpress.XtraEditors.XtraForm            //Form
        {
            private CommonFunctions commFunc = null;
    
            public Form1()
            {
                InitializeComponent();
                commFunc = CommonFunctions.Singlon();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                commFunc.AddAppStyles2ComboBoxEdit(cmbAppStyle);
            }
    
            private void cmbAppStyle_SelectedIndexChanged(object sender, EventArgs e)
            {
                this.defaultLookAndFeel1.LookAndFeel.SkinName = cmbAppStyle.EditValue.ToString();
            }
    
        }
    }
    

    (3)CommonFunctions.cs

    using DevExpress.XtraEditors;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace TestExpressSkins
    {
        class CommonFunctions
        {
            #region 单例
    
            private static CommonFunctions commFuncInstance = null;
    
            private CommonFunctions()
            {
            }
    
            public static CommonFunctions Singlon()
            {
                if (null == commFuncInstance)
                {
                    commFuncInstance = new CommonFunctions();
                }
                return commFuncInstance;
            }
    
            #endregion
    
            /// <summary>
            /// 皮肤全部枚举出来放到一个ComboBoxEdit中
            /// </summary>
            /// <param name="comboBoxEdit"></param>
            public void AddAppStyles2ComboBoxEdit(ComboBoxEdit comboBoxEdit)
            {
                foreach (DevExpress.Skins.SkinContainer skin in DevExpress.Skins.SkinManager.Default.Skins)
                {
                    comboBoxEdit.Properties.Items.Add(skin.SkinName);
                }
            }
    
            public bool tmpFunc()
            {
                bool bFlag = true;
               
                return bFlag;
            }
        }
    }
    
  • 相关阅读:
    css属性设置
    自由从摇篮开始 ——杨支柱
    提醒幸福
    随记
    那些回不去的年少时光(桐华)
    Javascript 与正则表达式
    XmlHttpRequest对象的获取及相关操作
    CSS的4种引入方式及优先级
    c#textBox控件限制只允许输入数字及小数点,是否为空
    c# 循环界面控件
  • 原文地址:https://www.cnblogs.com/shenchao/p/4043691.html
Copyright © 2020-2023  润新知