为什么启动后的应用程序看起来与设计师不同?
我有一个问题。我是WPF的新手,我发生了一件奇怪的事情。在设计师中,一切看起来都不错,但是一旦我启动应用程序,就可以切断“(Via.photo)”,看起来很糟糕。是否可以响应应用程序?
我的XAML代码:
<TabItem Header="TabItem"
Visibility="Hidden"
x:Name="Home_Page"
Background="{x:Null}"
BorderBrush="{x:Null}" Height="Auto"
Width="Auto"
>
<Border
Background="Black"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="1340"
Height="1100"
CornerRadius="20"
>
<Border
Background="White"
CornerRadius="20"
Height="700"
Width="500"
Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center"
>
<Grid
>
<TextBlock
Text="Welcome"
Width="200"
Height="200"
Foreground="Black"
FontSize="50" FontFamily="/Peel_App;component/Fonts/#Kashima Brush Demo"
>
</TextBlock>
</Grid>
</Border>
</Border>
</TabItem>
I have a little question. I'm new to WPF and a strange thing happened to me. In the designer everything looks fine, but as soon as I start the application, a piece ,,cuts off"(via.photo) and it looks pretty bad. Could it be that the application is not responsive?
My XAML code:
<TabItem Header="TabItem"
Visibility="Hidden"
x:Name="Home_Page"
Background="{x:Null}"
BorderBrush="{x:Null}" Height="Auto"
Width="Auto"
>
<Border
Background="Black"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="1340"
Height="1100"
CornerRadius="20"
>
<Border
Background="White"
CornerRadius="20"
Height="700"
Width="500"
Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center"
>
<Grid
>
<TextBlock
Text="Welcome"
Width="200"
Height="200"
Foreground="Black"
FontSize="50" FontFamily="/Peel_App;component/Fonts/#Kashima Brush Demo"
>
</TextBlock>
</Grid>
</Border>
</Border>
</TabItem>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的代码有一些问题:
保证金
值以定位控件。相反,您应该使用适当的面板(dockpanel
,wrappanel
和grid
)。使用保证金
属性设置保证金而不是位置。horizontalAlignment
和垂直安装
属性将元素定位,因此您的UI将更加响应和用户友好。d:designHeght
和d:designWidth
窗口上的属性。尝试使用Google如何使用它们。最后,您的代码应该如下:
Your code has a few issues:
Margin
values to position your controls. Instead, you should use proper panels (DockPanel
,WrapPanel
, andGrid
). UseMargin
property to set margin, not a position.HorizontalAlignment
andVerticalAlignment
properties to position your elements, thus your UI would be more responsive and user-friendly.d:DesignHeght
andd:DesignWidth
properties on a window. Try to Google how to use them.In the end, your code should look like following: