设置父窗体颜色

This commit is contained in:
czz_y 2024-08-20 10:46:51 +08:00
parent 8247b802c7
commit 27086aa1dc
2 changed files with 10 additions and 7 deletions

View File

@ -1,4 +1,5 @@
using System; using AntdUI;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Configuration; using System.Configuration;
@ -13,8 +14,10 @@ namespace AntdUIDemo.Controls
{ {
public partial class SystemSet : UserControl public partial class SystemSet : UserControl
{ {
public SystemSet() private Window Window;
public SystemSet(Window _window)
{ {
Window = _window;
InitializeComponent(); InitializeComponent();
//初始化下拉框 //初始化下拉框
InitSelectItems(); InitSelectItems();
@ -50,14 +53,14 @@ namespace AntdUIDemo.Controls
if (value) if (value)
{ {
AntdUI.Config.IsLight = true; AntdUI.Config.IsLight = true;
BackColor = Color.White; Window.BackColor = Color.White;
ForeColor = Color.Black; Window.ForeColor = Color.Black;
} }
else else
{ {
AntdUI.Config.IsDark = true;// 设置为深色模式 AntdUI.Config.IsDark = true;// 设置为深色模式
BackColor = Color.Black; Window.BackColor = Color.Black;
ForeColor = Color.White; Window.ForeColor = Color.White;
} }
} }

View File

@ -24,7 +24,7 @@ namespace AntdUIDemo
private void ButtonSZ_Click(object sender, EventArgs e) private void ButtonSZ_Click(object sender, EventArgs e)
{ {
using (var form = new SystemSet()) using (var form = new SystemSet(this))
{ {
AntdUI.Modal.open(new AntdUI.Modal.Config(this, "系统设置", form, TType.Info) AntdUI.Modal.open(new AntdUI.Modal.Config(this, "系统设置", form, TType.Info)
{ {