• 制作自定义样式的窗口


    不使用windows自带的窗口样式,使用自定义的客户区,

    <Window xmlns:my="clr-namespace:MiniFileTransferClient.Presentation.WPF.UILogic.ShowPanels"  x:Class="MiniFileTransferClient.Presentation.WPF.MiniFileTransferViewer"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MiniFileTransferViewer"  WindowStyle="None"  AllowsTransparency="True"
            MouseLeftButtonDown="Window_MouseLeftButtonDown"  StateChanged="Window_StateChanged" Height="530" Width="395"
            Background="Transparent">
        <Border   Height="530" Width="395"  BorderBrush="Gray" BorderThickness="0"   CornerRadius="5,5,5,5">
            <Border.Background>
                <ImageBrush ImageSource="/MiniFileTransferClient.Presentation.WPF;component/Images/zhujiemian.png"/>
            </Border.Background>
        </Border>
    </Window>

    其中WindowStyle="None"、AllowsTransparency="True" 、Background="Transparent"这三个属性都是要设定的。由于现在默认的非客户区没有了,按下鼠标是不能拖动窗口的,必须在设定鼠标左键按下时的情况,就有了MouseLeftButtonDown="Window_MouseLeftButtonDown" 事件对应的代码:

                    private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
                    {
                            this.DragMove();
                    }
  • 相关阅读:
    2.27
    string.Format("{0,-50}", "qqqqqqqqqqqq")
    dataGridView
    dataGridView添加列行
    设置拖拽事件,获取拖拽内容
    ,鼠标右键,将ListView的内容存入剪贴板
    winform ListView点击行表头,排序
    Aes加密解密
    C#get ,post HttpClient
    将json格式的string转化为对象
  • 原文地址:https://www.cnblogs.com/goxmpx/p/3751329.html
Copyright © 2020-2023  润新知