Skip to main content
 首页 » 编程设计

c#之WPF 中可调整大小的自定义窗口

2024年02月23日13duanxz

我需要使用 WindowStyle.None、AllowsTransparency = true 等创建自定义窗口

和“可调整大小”

如何帮助我创建可调整大小的这个?

坦克斯...

请您参考如下方法:

最简单的解决方案是实现 ResizeMode属性,将其设置为“CanResizeWithGrip”。

<Window x:Class="TestProject.ScratchWindow" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   
        Opacity="1.0"  
 
        ResizeMode="CanResizeWithGrip" 
 
        WindowStyle="None"  
        AllowsTransparency="True" 
        Title="Test Window"> 
 
    <!-- Window Contents Here --> 
</Window>