9

WPF中Window如何设置为固定大小?

 3 years ago
source link: http://blog.devwiki.net/index.php/2020/01/30/wpf-set-normal-size.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

DevWiki

WPF中Window如何设置为固定大小?
如果想要窗口大小一致保持固定大小, 且不能使用鼠标拉大或者缩小 需要将 width 和 height 的两组值保持...
扫描右侧二维码阅读全文
30
2020/01

WPF中Window如何设置为固定大小?

  1. 首页

如果想要窗口大小一致保持固定大小, 且不能使用鼠标拉大或者缩小 需要将 width 和 height 的两组值保持一致, 即:

  • Width, MinWidth, MaxWidth 设置为相同值
  • Height, MinHeight, MaxHeight 设置为相同值

同时设置 ResizeMode="NoResize", 如下所示:

<Window x:Class="Rsser.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"
        mc:Ignorable="d"
        Title="MainWindow"
        Width="340" MinWidth="340" MaxWidth="340"
        Height="600" MinHeight="600" MaxHeight="600"
        ResizeMode="NoResize">
</window>
最后修改:2020 年 01 月 30 日 12 : 43 AM
如果觉得我的文章对你有用,请随意赞赏

发表评论 取消回复

评论 *

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK