如何更改整个应用程序的默认LookAndFeel?

发布于 2024-10-14 10:27:58 字数 526 浏览 2 评论 0原文

此页面列出了使用 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 回来...有建议吗?

This page lists a way to change the default LookandFeel for a .net application using DevExpress 10.2. It's not working for me.

My code (in Main())

imports DevExpress.LookAndFeel

DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Caramel"
DevExpress.LookAndFeel.UserLookAndFeel.Default.UseWindowsXPTheme = False
DevExpress.LookAndFeel.UserLookAndFeel.Default.LookAndFeelStyle.Office2003

My users hate this new grey theme and want Caramel back... suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

莫相离 2024-10-21 10:27:58

你的代码应该可以工作。但您必须确保所有表单均源自 DevExpress.XtraEditors.XtraForm(对于 Winforms 应用程序)。否则,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”文件夹中找到。

完整的代码如下所示:

DevExpress.UserSkins.BonusSkins.Register();
DefaultLookAndFeel defaultLF = new DefaultLookAndFeel();
defaultLF.LookAndFeel.UseDefaultLookAndFeel = true;

Your code should work. But you have to make sure that all your forms are derived from DevExpress.XtraEditors.XtraForm (for a Winforms-Application). Otherwise the LookAndFeel will not be propagated to the controls on the forms.
In general: if you place a devexpress control in a container that is not derived from a devexpress container the look-and-feel will not change.

Edit: the original question & answer was for DevExpress v 10.x. Starting with DevExpress V 2011.2 you need to reference a "DevExpress.BonusSkins.vXX.Y"-library in your project and register the bonus skins via

DevExpress.UserSkins.BonusSkins.Register();

The bonus skin libraries are called e.g. "DevExpress.BonusSkins.v12.1.DLL" and can be found in the "\Bin\Framework"-Folder of your DevExpress-installation.

Complete code would look like:

DevExpress.UserSkins.BonusSkins.Register();
DefaultLookAndFeel defaultLF = new DefaultLookAndFeel();
defaultLF.LookAndFeel.UseDefaultLookAndFeel = true;
日裸衫吸 2024-10-21 10:27:58

当您创建使用任何 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());
}

有关更多详细信息,请参阅此链接

When you create a project that uses any Developer Express component, a reference to the DevExpress.Utils library is added to it. This library contains helper classes common to all components and also provides some default skins

(e.g. DevExpress Style, Metropolis, VS2010, Office 2010 Blue, etc.).

Other skins

(Caramel, Coffee, Liquid Sky, Stardust, etc.)

are implemented in the DevExpress.BonusSkins library

To register skins shipped with the DevExpress.BonusSkins library, call the static Register method of the DevExpress.UserSkins.BonusSkins class.

[STAThread]
static void Main() {
    // Skin registration. 
    DevExpress.UserSkins.BonusSkins.Register();
    Application.Run(new Form1());
}

See this link for more details.

赏烟花じ飞满天 2024-10-21 10:27:58

以下代码应该适合您:

 DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Caramel"
 DevExpress.LookAndFeel.UserLookAndFeel.Default.UseWindowsXPTheme = False

The following code should work for you:

 DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Caramel"
 DevExpress.LookAndFeel.UserLookAndFeel.Default.UseWindowsXPTheme = False
魂ガ小子 2024-10-21 10:27:58

在我读了很多之后,我确实喜欢这个并且运行得非常完美!

1 - 创建一个模块并编写以下代码:

导入 DevExpress.LookAndFeel

模块程序
 _
公共子主() 

   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" '例如!

   DevExpress.Skins.SkinManager.EnableMdiFormSkins()
   DevExpress.Skins.SkinManager.EnableFormSkins()

   应用程序.运行(新表单1)

结束子

终端模块

2 - 显然,在每个表单(Form1.Designer.vb)中更改此行:

部分类Form1

REM 继承 System.Windows.Forms.Form

继承DevExpress.XtraEditors.XtraForm

结束课程

祝你好运!

After i read much, i did like this and run me perfect!

1 - Create a module and write this code:

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 - And OBVIOUSLY Change this line in each form (Form1.Designer.vb):

Partial Class Form1

REM Inherits System.Windows.Forms.Form

Inherits DevExpress.XtraEditors.XtraForm

End Class

Good luck!

鸩远一方 2024-10-21 10:27:58

尝试将 LookAndFeelStyle 设置为“Skin”:

DevExpress.LookAndFeel.UserLookAndFeel.Default.LookAndFeelStyle.Skin

Try setting the LookAndFeelStyle to "Skin":

DevExpress.LookAndFeel.UserLookAndFeel.Default.LookAndFeelStyle.Skin
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文