WPF窗口样式比较

1.WPF默认Window窗口 带有图标 标题栏 最小最大化推出按钮
<Window x:Class="GlowWindowDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:GlowWindowDemo"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid&gt;
        
    </Grid&gt;
</Window&gt;

UI显示1

2.HandyControl拓展的Window窗口 隐藏默认图标
<hc:Window
    x:Class="GlowWindowDemo.Window3"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:hc="https://handyorg.github.io/handycontrol"
    xmlns:local="clr-namespace:GlowWindowDemo"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="Window3"
    Width="800"
    Height="450"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <Grid />
</hc:Window>

UI显示2

新增属性
属性描述

3.HandyControl拓展的GlowWindow窗口 窗口边框设置显示颜色 辉光效果
<hc:GlowWindow
    x:Class="GlowWindowDemo.Window2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:hc="https://handyorg.github.io/handycontrol"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="Window2"
    Width="800"
    Height="450"
    ActiveGlowColor="{DynamicResource PrimaryColor}"
    Background="{DynamicResource MainContentBackgroundBrush}"
    InactiveGlowColor="{DynamicResource DangerColor}"
    Style="{StaticResource WindowGlow}"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <Border Margin="10" Background="{DynamicResource LightInfoBrush}" />
</hc:GlowWindow>

UI显示3

4.GlowWindow非客户端区域设置自定义标题栏内容 设置显示的Log 文字
<hc:GlowWindow
    x:Class="GlowWindowDemo.Window4"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:hc="https://handyorg.github.io/handycontrol"
    xmlns:local="clr-namespace:GlowWindowDemo"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="Window4"
    Width="800"
    Height="450"
    Background="{DynamicResource RegionBrush}"
    ShowTitle="False"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">

    <!--  标题栏内容  -->
    <hc:GlowWindow.NonClientAreaContent>

        <StackPanel Background="{DynamicResource DarkInfoBrush}" Orientation="Horizontal">
            <hc:OutlineText
                Margin="3"
                Fill="{DynamicResource ColorPickerRainbowBrush}"
                FontSize="32"
                FontWeight="Bold"
                StrokeThickness="2"
                Text="Hello WPF" />
        </StackPanel>
    </hc:GlowWindow.NonClientAreaContent>
    <Grid />
</hc:GlowWindow>

UI显示4

注:当设置标题栏背景颜色时,鼠标标题栏区域无法拖动窗口移动!!!

UI显示5
设置标题栏背景颜色时,鼠标标题栏区域拖动窗口移动!!!

原文地址:https://blog.csdn.net/baidu_24565387/article/details/134710514

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_21328.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注