我在 WPF 中遇到了窗口不透明度的问题,我想做的是改变窗口的不透明度,但让孩子的不透明度保持不变。
这是我当前的代码:
Window window = new Window();
window.WindowStyle = WindowStyle.None;
window.AllowsTransparency = true;
window.Background = Brushes.Black;
window.Opacity = 0.5;
window.ShowInTaskbar = false;
double taskBarHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height - System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;
window.Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height - taskBarHeight;
window.Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
window.Top = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Top;
window.Left = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Left;
LoginCtl ctl = new LoginCtl(this);
window.Content = ctl;
window.ShowDialog();
我知道孩子的不透明度不能比他们的父母高,但是有没有可能的解决方法?