百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

Dark-Mode-Forms

> 编程语言
开源

将深色模式应用于表单中的所有控件 [WinForms]

186 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

将深色模式应用于表单中的所有控件 [WinForms]

Dark-Mode-Forms

Apply Dark Mode to all Controls in a Form [WinForms]

  • This will detect if dark mode color is enabled in Windows settings.
  • Then iterate all the controls on your form and try to convert them to DarkMode (if enabled).
  • [Optional] If you have icons on your menus or toolbars, they will be recolored to give you a lighter, more visible-in-the-dark version of your icons. (Works best with monochrome icons)
  • You can access Windows Dark Colors and use them for whatever you need.

Now with Dark Messenger

Window's default MessageBox cant not be themed, so Added a Messenger.cs class that allowes the user to popup Messages and InputBoxes:

  • Messenger.MessageBox is a Direct replacement for the old MessageBox.Show, the new one applies Windows's Dark Mode automaticaly.

  • Messenger.InputBox is a replacement for VisualBasic's InputBox, implemented for C# and with extended functionalities:

    • In its simplies form, you ask the user for a Text Input, then you use that for whatever you need
    • But Messenger.InputBox allowes you to promt the user with many more 'Fields' of different types:
  • Button Texts are automatically translated to 7 Languages: en, es, de, fr, ru, kr, zh.

  • DarkMode doesnt require the Messenger but Messenger does require DarkMode.

MessageBox:

csharp
try
{
   if (Messenger.MessageBox("Hello World!", "You got a Message:",
       MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
   {
      //Do Something here.
   }
}
catch (Exception ex)
{
   Messenger.MessageBox(ex);
}

InputBox:

…

Example of a LoginForm with Password Validation:

…

Implementation

  • No Nuggets, No external DLLs, Just 1 File: DarkModeCS.cs Copy/Paste or Download and import it into your project.
csharp
private DarkModeCS dm = null;

public Form1()
{
	InitializeComponent();
	dm = new DarkModeCS(this)
	{
		//[Optional] Choose your preferred color mode here:
		ColorMode = DarkModeCS.DisplayMode.SystemDefault
	};
}

Dark Mode Colors

Framework Compatibility

  • .NET 4.8+
  • .NET 6.0+
  • .NET 8.0+
  • Some stuff may only work on Windows 11+
  • VS 2022+

Limitations

There are a few Winforms Controls that are, by design, extremely hard to theme:

  • TabControl: 90% themed, a white border around the selected tab still remains. You could use FlatTabControl instead, check in the Example.
  • MessageBox: Can't be themed. You can use Messenger instead.
  • DateTimePicker: Un-themed.
  • MonthCalendar: Un-themed.
  • ProgressBar: Un-themed. You can use FlatProgressBar instead.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言