窗户尺寸 [英] Windows size

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

问题描述

我有一个窗口,我在其中放置了所有控件 例如文本框,日期,标签,按钮等.

I have a window where i placed all the controls   like textbox,date,labels,button etc.

窗口应等于屏幕尺寸.我该怎么设置.

the windows should be equal to screen size. how can i set that.

并且控件应适合该屏幕尺寸.我该怎么办?

And the controls should be fit in that screen size. How can  i do that?

此致

Annss

推荐答案

>>窗口应等于屏幕尺寸.我该怎么设置.

将WindowState属性设置为最大化":

Set the WindowState property to Maximized:

public MainWindow()
        {
            InitializeComponent();
            this.WindowState = System.Windows.WindowState.Maximized;
 }

>>并且控件应适合该屏幕尺寸.怎么可以我这样做吗?

选择适当的根面板,例如Grid或DockPanel:

Choose an appropriate root panel such as for example a Grid or a DockPanel:

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
  ...
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
  ...
        </Grid.ColumnDefinitions>
...

有关不同布局面板及其特征的更多信息,请参考以下链接

Please refer to the following links for more information about the different layout panels and their characteristics

http://msdn.microsoft.com/en-us/library/ms754152(v = vs.110).aspx
http://www.wpf-tutorial.com/panels/introduction-to-wpf-panels /

请记住,通过单击标记为答案"将有用的帖子标记为答案来关闭话题.有用的帖子下面的链接.

And please remember to close your threads by marking helpful posts as answer by clicking on the "Mark as answer" link below the helpful post.


这篇关于窗户尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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