C# 调整大小的控件(按钮)
溢出社区, 我对控件的大小有一些问题(更具体的是:按钮) 背景故事: 我使用的程序要求您连接到特定的网站(通过我的计算机上的程序托管)。我希望使用Microsoft Visual Studio中的WPF c#web浏览器工具,而不是打开我首选的web浏览器。 现在: 我已经这样做了,当窗口调整大小时,web浏览器工具可以调整大小,但调整大小会影响按钮(总共2个)。按钮变小了,但它们只会增长到设定的大小(如设计器中所示)。XAML视图:C# 调整大小的控件(按钮),c#,wpf,xaml,C#,Wpf,Xaml,溢出社区, 我对控件的大小有一些问题(更具体的是:按钮) 背景故事: 我使用的程序要求您连接到特定的网站(通过我的计算机上的程序托管)。我希望使用Microsoft Visual Studio中的WPF c#web浏览器工具,而不是打开我首选的web浏览器。 现在: 我已经这样做了,当窗口调整大小时,web浏览器工具可以调整大小,但调整大小会影响按钮(总共2个)。按钮变小了,但它们只会增长到设定的大小(如设计器中所示)。XAML视图: <Window x:Name="PhantomBot_
<Window x:Name="PhantomBot_Browser" x:Class="PhantomBot_Browser_.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"
xmlns:local="clr-namespace:PhantomBot_Browser_"
mc:Ignorable="d"
ResizeMode="CanResize"
Title="PhantomBot Browser" Height="446.079" Width="731.863">
<Grid>
<Grid x:Name="grid1" HorizontalAlignment="Left" VerticalAlignment="Top" Height="auto" Width="auto" >
<Grid Margin="0,35,0,0">
<Border HorizontalAlignment="Left" Width="auto" Height="auto">
<WebBrowser x:Name="webbrowser1" ClipToBounds="True" Height="auto" Width="auto" />
</Border>
</Grid>
<Grid Margin="10,10,663,385">
<Button x:Name="refresh_button" Content="Refresh" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Height="auto" Click="refresh_button_Click"/>
</Grid>
<Grid Margin="66,10,624,385">
<Button x:Name="gobutton" Content="GO" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Height="auto" Click="gobutton_Click"/>
</Grid>
</Grid>
</Grid>
我希望按钮保持在它们的位置和大小
更新:(部分图片)
当程序处于小尺寸时的图片(查看左上角的按钮!)
当程序处于较大尺寸时的图片(按钮可以)
不要介意连接错误,它是故意的。Grid 101:支持添加行和列,并为每个行和列设置高度/宽度,这可以是相对于包含元素的,也可以是固定的。 例如:
<Grid>
<Grid.RowDefintions>
<RowDefintion Height="Auto"/> Will receive height per child in that row.
<RowDefintion Height="5"/> Height is 5 pixels
<RowDefinition Height=""/> Height is remaining space (Height in this case)
<RowDefintion Height="2"/> Height is twice the height the preceeding row
</Grid.RowDefintions>
</Grid>
将获得该行中每个孩子的身高。
高度为5像素
高度是剩余空间(本例中为高度)
高度是前一行高度的两倍
请您提供一张图片或其他东西,清楚地展示您希望窗口的实际外观,好吗?
<Grid>
<Grid.RowDefintions>
<RowDefintion Height="Auto"/> Will receive height per child in that row.
<RowDefintion Height="5"/> Height is 5 pixels
<RowDefinition Height=""/> Height is remaining space (Height in this case)
<RowDefintion Height="2"/> Height is twice the height the preceeding row
</Grid.RowDefintions>
</Grid>