步入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.1\Components\Sources\DevExpress.DLL”,拷貝到自己需要的地方,以方便項(xiàng)目添加引用時(shí)通過(guò)“瀏覽”找到;不拷貝也可以,項(xiàng)目引用時(shí)選擇“項(xiàng)目集”>>“擴(kuò)展”下找到。
3、在界面的“工具箱”中,添加一選項(xiàng)卡,命名如:“DevExpress”,并右擊“選擇項(xiàng)”,在.Net Framework組件中找到需要的控件名(可按控件的首字符查找),如:“DefaultLookAndFeel”,然后添加對(duì)應(yīng)的DLL,如“DevExpress.Utils.v11.1.dll”(若自動(dòng)添加也可以不添加)。
4、向?qū)υ捒蛑刑砑?#xff1a;DefaultLookAndFeel、ComboBoxEdit控件等
5、實(shí)現(xiàn)的具體代碼如下:
(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>/// 應(yīng)用程序的主入口點(diǎn)。/// </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>/// 皮膚全部枚舉出來(lái)放到一個(gè)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;}} }?
總結(jié)
以上是生活随笔為你收集整理的步入DevExpress的使用(VS)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: windows git安装到把项目推送
- 下一篇: [NHibernate]事务