C# 学习笔记
本文最后更新于 2019年11月28日 已经是 1398天前了 ,文章可能具有时效性,若有错误或已失效,请在下方留言

环境

这里博主用的是
VS

UI界面

采用MahApps.Metro
smirk:
1. 安装Nuget的 MahApps.Metro
2. 添加引用
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"

将<Window …标签更改为 <Controls:MetroWindow

  1. 更改.CS代码文件:
public partial class MainWindow : MetroWindow
  1. 替换app.xml
<Application x:Class="WpfApplication.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
                <ResourceDictionary Source="/Resources/Icons.xaml" />
                <!-- Accent and AppTheme setting -->
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
  1. 最大化最小化按钮
<Controls:MetroWindow x:Class="WpfApplication.MainWindow"
...
                      ShowIconOnTitleBar="True"
                      ShowTitleBar="True">
</Controls:MetroWindow>
  1. 记住窗口位置
aveWindowPosition=”True|False”
  1. 窗口边框
    • 有边框
BorderBrush="{DynamicResource AccentColorBrush}"
BorderThickness="1"
  • 发光边框
GlowBrush="{DynamicResource AccentColorBrush}"
  • 阴影边框
GlowBrush="{DynamicResource AccentColorBrush}"
广告 广告位招租

评论

  1. enjoy
    Android Chrome
    河北省廊坊市
    4年前
    2019-9-08 8:08:20

    Test 测试

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
小黄脸
上一篇
下一篇