NEWS

[DEVEXPRESS] Hướng dẫn thay đổi giao diện Palette trên Skin The Bezier

[DEVEXPRESS] Hướng dẫn thay đổi giao diện Palette trên Skin The Bezier
Đăng bởi: Thảo Meo - Lượt xem: 7888 08:36:21, 03/11/2018C#   In bài viết

Xin chào các bạn, bài viết hôm nay mình sẽ hướng dẫn cho các bạn cách thay đổi Palette trên Skin The Bezier của Devexpress từ phiên bản 17 trở lên.

Từ phiên bản Devexpress 17 trở lên, Devexpress có cung cấp cho chúng ta thêm một số Skin và trong đó đặc biệ là Skin The Bezier, có tích hợp thêm phần chỉnh Palette.

Dưới đây là Video demo thay đổi giao diện Palette trên Devexpress:

Source code C#:

using DevExpress.Customization;
using DevExpress.LookAndFeel;
using DevExpress.Skins;
using DevExpress.Utils.Svg;
using DevExpress.XtraBars;
using FluentWinform.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FluentWinform
{
    public partial class Form1 : DevExpress.XtraBars.FluentDesignSystem.FluentDesignForm
    {
        public Form1()
        {
            InitializeComponent();
            this.LookAndFeel.SetSkinStyle(SkinStyle.Bezier, SkinSvgPalette.Bezier.OfficeColorful);
            this.FormClosing += Form1_FormClosing;
            RestorePalette();
            

        }

        private void SavePalette()
        {
          
            //if (UserLookAndFeel.Default.SkinName == "The Bezier")
            //{
                Settings.Default["Palette"] = UserLookAndFeel.Default.ActiveSvgPaletteName;
            //}
            Settings.Default.Save();
        }

       

        private void ShowSwatchPicker(Form owner)
        {
            using (var dialog = new DevExpress.Customization.SvgSkinPaletteSelector(owner))
            {
                dialog.ShowDialog();
                SavePalette();
            }
        }

        private void RestorePalette()
        {
            if (Settings.Default["SkinName"] != null && Settings.Default["SkinName"].ToString() != string.Empty)
            {
                if (Settings.Default["SkinName"].ToString() == "The Bezier" && Settings.Default["Palette"] != null && Settings.Default["Palette"].ToString() != string.Empty)
                {
                    UserLookAndFeel.Default.SetSkinStyle(Settings.Default["SkinName"].ToString(), Settings.Default["Palette"].ToString());
                }
                else
                    SetSkin(Settings.Default["SkinName"].ToString());

            }
            else if (Settings.Default["Palette"] != null && Settings.Default["Palette"].ToString() != string.Empty)
            {
                UserLookAndFeel.Default.SetSkinStyle(SkinStyle.Bezier, Settings.Default["Palette"].ToString());
            }
        }

        private void accordionControlElement2_Click(object sender, EventArgs e)
        {
            if (!div_container.Controls.Contains(uc_moigioi.Instance))
            {
                div_container.Controls.Add(uc_moigioi.Instance);
                uc_moigioi.Instance.Dock = DockStyle.Fill;
                uc_moigioi.Instance.BringToFront();
            }
            else
                uc_moigioi.Instance.BringToFront();

           
        }

        private void accordionControlElement3_Click(object sender, EventArgs e)
        {
            if (!div_container.Controls.Contains(uc_mergeExcel.Instance))
            {
                div_container.Controls.Add(uc_mergeExcel.Instance);
                uc_mergeExcel.Instance.Dock = DockStyle.Fill;
                uc_mergeExcel.Instance.BringToFront();
            }
            else
                uc_mergeExcel.Instance.BringToFront();
        }
        private void SetSkin(string skinName)
        {
            UserLookAndFeel.Default.SetSkinStyle(skinName);
        }


        private void btn_ChangeSkin_Click(object sender, EventArgs e)
        {
            ShowSwatchPicker(this);
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            SavePalette();
        }

       
    }
}

HAVE FUN :)

DOWNLOAD SOURCE

THÔNG TIN TÁC GIẢ

BÀI VIẾT LIÊN QUAN

[DEVEXPRESS] Hướng dẫn thay đổi giao diện Palette trên Skin The Bezier
Đăng bởi: Thảo Meo - Lượt xem: 7888 08:36:21, 03/11/2018C#   In bài viết

CÁC BÀI CÙNG CHỦ ĐỀ

Đọc tiếp
.