1. 程式人生 > >DevExpress TabPage巢狀時去掉邊框

DevExpress TabPage巢狀時去掉邊框

使用DevExpress中TabControl時,如果巢狀使用即使設定每個TabPage的Padding都為0,仍然在底部和右側出現邊框,如下圖所示:

解決方案:

在Program中使用Skin的同時,設定Tab的面板樣式,程式碼如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using DevExpress.LookAndFeel;
using DevExpress.Skins;

namespace Jesus.WinApplication
{
    static class Program
    {
        /// <summary>
        /// 應用程式的主入口點。
        /// </summary>
        [STAThread]
        static void Main()
        {
            DevExpress.UserSkins.BonusSkins.Register();
            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.Skins.SkinManager.EnableMdiFormSkins();

            DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Money Twins");

            // The following line provides localization for the application's user interface. 
            System.Threading.Thread.CurrentThread.CurrentUICulture =
                new System.Globalization.CultureInfo("zh-CN");

            // The following line provides localization for data formats. 
            System.Threading.Thread.CurrentThread.CurrentCulture =
                new System.Globalization.CultureInfo("zh-CN");



            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //設定TabPage邊框為0
            SkinElement element = SkinManager.GetSkinElement(SkinProductId.Tab, DevExpress.LookAndFeel.UserLookAndFeel.Default, "TabPane");
            element.ContentMargins.Right = 0;
            element.ContentMargins.Bottom = 0;
            LookAndFeelHelper.ForceDefaultLookAndFeelChanged();

            Application.Run(new FrLogin());
        }
    }
}