SetPreferredMinSize包含什么 [英] What does SetPreferredMinSize include

查看:91
本文介绍了SetPreferredMinSize包含什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用程序视图上的SetPreferredMinSize是设置客户端区域还是包含装饰?  如果它确实包含装饰,那么有没有办法获得装饰尺寸,所以我们可以说我们希望客户区域不小于X?

Does SetPreferredMinSize on application view set the client area or does it include decorations as well?  If it does include decorations is there a way to get the decoration size so we can say we want the client area to be no smaller than X?

推荐答案

Hi Perter,

Hi Perter,

欢迎来到开发通用Windows应用程序论坛! 

请阅读粘贴帖子,特别是  引导
发布:主题行标签
   Windows 10 SDK和工具的已知问题&n bsp;

Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools .

你对装饰品的意思是什么?

What do you mean of the decorations?

你的意思是TitleBar吗?如果是这样,应用程序视图上的SetPreferredMinSize不包含装饰。

Do you mean the TitleBar? If so, the SetPreferredMinSize on application view not include the decorations.

此外,我们可以通过以下代码获取TitleBar高度:

Also we can get the TitleBar height by the following code:

public MainPage()
{
    this.InitializeComponent();
    CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false;
}

private void Button_Click(object sender, RoutedEventArgs e)
{
    ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(300, 400));
    Window.Current.SizeChanged += Current_SizeChanged;
    heightOriginal = Window.Current.Bounds.Height;
    CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
}

private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e)
{
    var heightNew = Window.Current.Bounds.Height;
    var TitleBarHeight = heightNew - heightOriginal;
    Debug.WriteLine("TitleBarHeight=======" + TitleBarHeight);
}

如果你想设置包含TitleBar的大小,你应该能够设置高度值减去TitleBarHeight。

If you want to set the Size that include TitleBar, you should able to set the height value minus TitleBarHeight.

最好的问候,

Jayden Gu

Jayden Gu


这篇关于SetPreferredMinSize包含什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆