DevExpress TabPage嵌套时去掉边框

使用DevExpress中TabControl时,如果嵌套使用即使设置每个TabPage的Padding都为0,仍然在底部和右侧出现边框,如下图所示:

DevExpress TabPage嵌套时去掉边框_第1张图片

解决方案:

在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
    {
        /// 
        /// 应用程序的主入口点。
        /// 
        [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());
        }
    }
}



你可能感兴趣的:(DevExpress应用)