zoukankan      html  css  js  c++  java
  • 制作自定义样式的窗口

    不使用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();
                    }
  • 相关阅读:
    基于jQuery的上下无缝滚动应用(单行或多行)
    表单验证
    中国剩余定理 ( 的学习 )
    扩展欧几里德算法--学习笔记
    Vijos P1794 文化之旅
    1336 : Matrix Sum (hihocoder)
    nyoj 1030 hihocoder 1338
    多重邻接表
    图的存储 ( 十字链表 )
    01背包的变形
  • 原文地址:https://www.cnblogs.com/goxmpx/p/3751329.html
Copyright © 2011-2022 走看看