问题描述
我在WPF中开发了Windows应用程序。创建exe我安装在另一台计算机后它工作正常。但是当我安装在YAN(投影仪)中时,按钮文本设计在我的计算机中出现时显示不正确。
当我更改投影机页面的分辨率时看起来很小而且没有对齐。请帮助我。
I have developed windows application in WPF. After creating exe i installed in another computer it is working fine. But when i installed in YAN(projector) the buttons text design is not appearing properly as it is coming in my computer.
when i changed the resolution in projector Page is looking small and not aligned. please help me.
推荐答案
<Button Content="Button" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="150,140,150,140"/>
这里,HorizontalAlignment设置为Stretch,这意味着,当调整窗口大小时,按钮将被拉伸以适合。这与VerticalAlignment属性相同。
保证金:左= 150,顶部= 140,右= 150,底部= 140 - 这些边距值将按钮放置140像素距离从顶部和底部,也将按钮放置在距左和右150像素的距离。
现在,如果您调整屏幕大小,按钮将根据边距放置,并且按钮将被拉伸以适合窗口。
Here, HorizontalAlignment is set to Stretch, it means, the button will be stretched to fit when the window is resized. This is same for VerticalAlignment property.
Margin: Left = 150, Top = 140, Right = 150, Bottom = 140 - these margin values placing the button 140 pixel distance from Top and Bottom, also places the button 150 pixel distance from Left and Right.
Now if your resizes the screen, the button will be placed according to the margin, and the button wil be stretched to fit the window.
这篇关于如何使窗口适合WPF中的任何屏幕分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!