Skip to content

窗口最小化操作会导致窗口阴影消失 #1086

@34205037

Description

@34205037

窗口最小化操作会导致窗口阴影消失,已知 SourceGit 2025.08/2025.04 预编译版本都有同样问题,从最新源码编译也是一样。

重现步骤

  • 启动 SourceGit,此时窗体有阴影
  • 把窗口最小化
  • 还原窗口,窗口的阴影消失了
  • 注:把窗口最大化,然后再还原窗口,又可以让窗口阴影恢复

环境

  • sourcegit_2025.08
  • Windows 10 22H2 19045.5487
  • .Net 9.0.200

关于窗体阴影的其他问题

在我的测试项目中,只要加上如下代码,

<Window 
... ...
        ExtendClientAreaChromeHints="NoChrome"
        ExtendClientAreaToDecorationsHint="True"
... ...
>

则窗体本身就直接是没有阴影的。这似乎和 AvaloniaUI/Avalonia#9055 这个问题类似,但是我不知道官方是不认为这是一个bug?还是一直没处理?

而SourceGit的ChromelessWindow源码里做的是同样的设置,

... ...
else if (OperatingSystem.IsWindows())
{
    ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
    ExtendClientAreaToDecorationsHint = true;
    Classes.Add("fix_maximized_padding"); 
}

但是SourceGit的窗体初始却是有阴影的,这是怎么做到的?
我仔细查看了所有相关代码,包括styles在内,也没找到什么关键的东西,我是个Java开发者,对于csharp和avalonia都是纯粹的新手,不知道是不是我遗漏了其他什么?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingos-windowsThis issue only exists on Windows

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions