This page列出了一种使用DevExpress 10.2更改.net应用程序的默认LookandFeel的方法。它不适合我。
我的代码(Main()
)
imports DevExpress.LookAndFeel
DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Caramel"
DevExpress.LookAndFeel.UserLookAndFeel.Default.UseWindowsXPTheme = False
DevExpress.LookAndFeel.UserLookAndFeel.Default.LookAndFeelStyle.Office2003
我的用户讨厌这个新的灰色主题,并希望Caramel回来...建议?
答案 0 :(得分:4)
您的代码应该有效。但您必须确保所有表单都源自DevExpress.XtraEditors.XtraForm(对于Winforms-Application)。否则,LookAndFeel将不会传播到表单上的控件。 通常:如果将devexpress控件放在不是从devexpress容器派生的容器中,则外观不会改变。
编辑:原始问题&回答是针对DevExpress v 10.x.从DevExpress V 2011.2开始,您需要在项目中引用“DevExpress.BonusSkins.vXX.Y” - 库,并通过
注册奖励皮肤DevExpress.UserSkins.BonusSkins.Register();
奖励皮肤库被称为例如“DevExpress.BonusSkins.v12.1.DLL”,可以在DevExpress安装的“\ Bin \ Framework”-Folder中找到。
完整代码如下:
DevExpress.UserSkins.BonusSkins.Register();
DefaultLookAndFeel defaultLF = new DefaultLookAndFeel();
defaultLF.LookAndFeel.UseDefaultLookAndFeel = true;
答案 1 :(得分:2)
创建使用任何Developer Express组件的项目时,会向其添加对DevExpress.Utils
库的引用。该库包含所有组件通用的辅助类,还提供了一些默认皮肤
(例如DevExpress Style,Metropolis,VS2010,Office 2010 Blue等)。
其他皮肤
(焦糖,咖啡,液体天空,星尘等)
在DevExpress.BonusSkins库中实现
要注册DevExpress.BonusSkins库附带的外观,请调用DevExpress.UserSkins.BonusSkins
类的静态Register方法。
[STAThread]
static void Main() {
// Skin registration.
DevExpress.UserSkins.BonusSkins.Register();
Application.Run(new Form1());
}
有关详细信息,请参阅this link。
答案 2 :(得分:1)
以下代码适合您:
DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Caramel"
DevExpress.LookAndFeel.UserLookAndFeel.Default.UseWindowsXPTheme = False
答案 3 :(得分:1)
在我读完之后,我确实喜欢这样,让我完美无缺!
1 - 创建一个模块并编写此代码:
Imports DevExpress.LookAndFeel Module Program <STAThread()> _ Public Sub Main() DevExpress.UserSkins.BonusSkins.Register() DevExpress.UserSkins.OfficeSkins.Register() DevExpress.LookAndFeel.UserLookAndFeel.Default.UseWindowsXPTheme = False DevExpress.LookAndFeel.UserLookAndFeel.Default.UseDefaultLookAndFeel = True DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Caramel" 'For Example! DevExpress.Skins.SkinManager.EnableMdiFormSkins() DevExpress.Skins.SkinManager.EnableFormSkins() Application.Run(New Form1) End Sub End Module
2 - 并且显然在每种形式(Form1.Designer.vb)中更改此行:
祝你好运!Partial Class Form1 REM Inherits System.Windows.Forms.Form Inherits DevExpress.XtraEditors.XtraForm End Class
答案 4 :(得分:0)
尝试将LookAndFeelStyle设置为“Skin”:
DevExpress.LookAndFeel.UserLookAndFeel.Default.LookAndFeelStyle.Skin