WPF窗口样式的比较

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>
        
    </Grid>
</Window>

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
不设置标题栏背景颜色时,鼠标在标题栏区域可拖动窗口移动!!!

相关推荐

  1. WPF之Datagrid表头样式修改

    2023-12-07 16:34:08       35 阅读
  2. WPF 基础入门(样式

    2023-12-07 16:34:08       40 阅读
  3. wpf 按钮禁用样式

    2023-12-07 16:34:08       13 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-07 16:34:08       19 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-07 16:34:08       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-07 16:34:08       20 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-07 16:34:08       20 阅读

热门阅读

  1. HTML试题——附答案

    2023-12-07 16:34:08       28 阅读
  2. 【量子机器学习】量子机器学习的介绍

    2023-12-07 16:34:08       29 阅读
  3. uniapp连接蓝牙称(接收,发送)

    2023-12-07 16:34:08       37 阅读
  4. 面试篇算法:(一:排序算法)

    2023-12-07 16:34:08       41 阅读
  5. cesium 融合视频

    2023-12-07 16:34:08       39 阅读
  6. 【开源存储】OpenZFS文件系统部署实践

    2023-12-07 16:34:08       43 阅读
  7. 8. 队列

    8. 队列

    2023-12-07 16:34:08      42 阅读
  8. vue3学习网站

    2023-12-07 16:34:08       44 阅读
  9. Elasticsearch-Kibana使用教程

    2023-12-07 16:34:08       29 阅读
  10. Android Audio实战——音频焦点监听(十)

    2023-12-07 16:34:08       39 阅读
  11. mysql基本命令

    2023-12-07 16:34:08       37 阅读