我的Windows窗体响应高度= 600,宽度= 1050.我正在使用网格,每个东西都按行和列设置,并且网格和行内的网格。 我希望这个表格应该对每个分辨率都有反应,比如我在下面给出的粘贴图像。所以我该怎么办呢?????
<Window x:Class="GiorgentiWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="600" Width="1050" MinHeight="600" MinWidth="1050" WindowStartupLocation="CenterScreen">
<Grid Width="auto" HorizontalAlignment="Stretch" Background="#FFE8E8E8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90*" />
<ColumnDefinition Width="431*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="60*"/>
<RowDefinition Height="933*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" HorizontalAlignment="Left" Height="37" VerticalAlignment="Top" Width="1042" Grid.ColumnSpan="2" Grid.RowSpan="2">
<Image HorizontalAlignment="Left" Height="37" Margin="3,0,0,0" VerticalAlignment="Top" Width="46" RenderTransformOrigin="0.475,0.472"/>
<Menu HorizontalAlignment="Left" Margin="56,0,0,10" Width="auto" Background="Transparent">
<MenuItem Header="_File" Height="30" FontSize="15" FontStretch="SemiExpanded">
<MenuItem Header="Tools">
<MenuItem Header="Print Designer"/>
<MenuItem Header="User Information"/>
<MenuItem Header="Addons"/>
</MenuItem>
<MenuItem Header="Performance">
<MenuItem Header="Compnay" Background="#FFCB5A5A"/>
<MenuItem Header="WorkStation"/>
</MenuItem>
<MenuItem Header="Hardware Setup Wizard"/>
<MenuItem Header="Clock In/Out"/>
<MenuItem Header="Exit"/>
</MenuItem>
<MenuItem Header="_Point Of Sale" Height="auto" FontSize="15" FontStretch="SemiExpanded">
<MenuItem Header="New Sales Receipt"/>
<MenuItem Header="New Return Receipt"/>
<MenuItem Header="New Payment"/>
<MenuItem Header="New Sales Order"/>
<MenuItem Header="New Layaway"/>
<MenuItem Header="New WorkOrder"/>
<MenuItem Header= "Sales History"/>
<MenuItem Header="Held Receipt "/>
<MenuItem Header="Sales Order Lists"/>
<MenuItem Header="Layaway List"/>
<MenuItem Header="Work Order List"/>
<MenuItem Header="Open Cash Drawer Ctrl+F8"/>
<MenuItem Header="End Of Day Procedure"/>
</MenuItem>
<MenuItem Header="_Customer" Height="auto" FontSize="15" FontStretch="SemiExpanded">
<MenuItem Header="New Customer"/>
<MenuItem Header="Customer List"/>
<MenuItem Header="Record Manager"/>
<MenuItem Header="Create an E-mail Campaign"/>
<MenuItem Header="Customer Center"/>
</MenuItem>
<MenuItem Header="_Inventory" Height="auto" FontSize="15" FontStretch="SemiExpanded">
<MenuItem Header="New Item"/>
<MenuItem Header="New Quantity Adjustment"/>
<MenuItem Header="New Cost Adjustment"/>
<MenuItem Header="New Transfer Slip"/>
<MenuItem Header="Item List"/>
<MenuItem Header="Department List"/>
<MenuItem Header="Quantity Adjustment History "/>
<MenuItem Header="Cost Adjustment History"/>
<MenuItem Header="Held Cost Adjustment Memos"/>
<MenuItem Header="Transfer History"/>
<MenuItem Header="Held Transfer Slip"/>
<MenuItem Header="Remainder"/>
<MenuItem Header="Start Physical Inventory"/>
<MenuItem Header="Price Manager"/>
</MenuItem>
<MenuItem Header="_Purchasing" Height="auto" FontSize="15" FontStretch="SemiExpanded">
<MenuItem Header="Receive Item"/>
<MenuItem Header="Return Voucher "/>
<MenuItem Header="New Purchase Order"/>
<MenuItem Header="New Vendor"/>
<MenuItem Header="Receiving History"/>
<MenuItem Header="Held Vochers"/>
<MenuItem Header="Purchase Order List"/>
<MenuItem Header="Vender List"/>
<MenuItem Header="Suggest PO"/>
</MenuItem>
<MenuItem Header="_Employee" Height="auto" FontSize="15" FontStretch="SemiExpanded">
<MenuItem Header="Employee List"/>
<MenuItem Header="Security"/>
<MenuItem Header="Change Employee Password"/>
<MenuItem Header="Clock In/Out"/>
<MenuItem Header="New Employee Time Entry"/>
<MenuItem Header="Time Clock History"/>
<MenuItem Header="Manage Clocked-in Employee"/>
</MenuItem>
<MenuItem Header="_Report" Height="auto" FontSize="15" FontStretch="SemiExpanded">
<MenuItem Header="Report Center"/>
<MenuItem Header="Dashboard"/>
<MenuItem Header="View Drawer Count History"/>
<MenuItem Header="Merchant Service Center"/>
<MenuItem Header="Sales"/>
<MenuItem Header="Cash Drawer"/>
<MenuItem Header="Payments"/>
<MenuItem Header="Customers"/>
<MenuItem Header="Items"/>
<MenuItem Header="Purchasing"/>
</MenuItem>
</Menu>
</Grid>
<Grid HorizontalAlignment="Left" Height="533" Grid.Column="0" VerticalAlignment="Top" Width="150" Grid.Row="1" Margin="21,0,0,0" Background="#FFE8E8E8">
<Button Content="I Want To....
" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="140" RenderTransformOrigin="0.35,-0.455" Height="55" FontWeight="Bold" FontSize="14" TextOptions.TextFormattingMode="Display" TextOptions.TextHintingMode="Animated">
<Button.Background>
<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FFF3F3F3"/>
<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
<GradientStop Color="#FFDDDDDD" Offset="0.5"/>
<GradientStop Color="#FF5DA62A" Offset="0.5"/>
<GradientStop Color="#FF539B23" Offset="0.483"/>
</LinearGradientBrush>
</Button.Background>
</Button>
<Button Content="Make a Sale
" HorizontalAlignment="Left" Margin="10,75,0,0" VerticalAlignment="Top" Width="140" RenderTransformOrigin="0.35,-0.455" Height="55" FontSize="14" FontWeight="Bold">
<Button.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFF3F3F3" Offset="0.096"/>
<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="1"/>
<GradientStop Color="#FF7590D3" Offset="0.257"/>
<GradientStop Color="#FFF3F3F3" Offset="0.087"/>
<GradientStop Color="#FF7590D3" Offset="0.087"/>
<GradientStop Color="#FF7590D3" Offset="0.035"/>
<GradientStop Color="#FF7590D3" Offset="0.13"/>
<GradientStop Color="#FF7590D3" Offset="0.413"/>
<GradientStop Color="#FF7590D3" Offset="0.478"/>
<GradientStop Color="#FF7590D3" Offset="0.009"/>
<GradientStop Color="#FF7590D3" Offset="0.078"/>
<GradientStop Color="#FF7590D3" Offset="0.1"/>
<GradientStop Color="#FF7590D3" Offset="0.091"/>
<GradientStop Color="#FF7590D3" Offset="0.096"/>
<GradientStop Color="#FF7590D3" Offset="0.487"/>
</LinearGradientBrush>
</Button.Background>
</Button>
<Button Content="Receive Items
" HorizontalAlignment="Left" Margin="10,140,0,0" VerticalAlignment="Top" Width="140" RenderTransformOrigin="0.35,-0.455" Height="55" FontSize="14" FontWeight="Bold">
<Button.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FF7590D3" Offset="0"/>
<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="1"/>
<GradientStop Color="#FF7590D3" Offset="0.291"/>
<GradientStop Color="#FF7590D3" Offset="0.496"/>
<GradientStop Color="#FF7590D3" Offset="0.5"/>
</LinearGradientBrush>
</Button.Background>
</Button>
<Button Content="Inventory" HorizontalAlignment="Left" Margin="10,205,0,0" VerticalAlignment="Top" Width="140" RenderTransformOrigin="0.35,-0.455" Height="55" FontSize="14" FontWeight="Bold">
<Button.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="1"/>
</LinearGradientBrush>
</Button.Background>
</Button>
<Button Content="Reports" Margin="10,270,0,203" HorizontalAlignment="Left" Width="140" Height="55" FontSize="14" FontWeight="Bold">
<Button.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="1"/>
</LinearGradientBrush>
</Button.Background>
</Button>
<Button Content="End Of Day
" HorizontalAlignment="Left" Margin="10,335,0,0" VerticalAlignment="Top" Width="140" RenderTransformOrigin="0.35,-0.455" Height="55" FontWeight="Bold" FontSize="14">
<Button.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="1"/>
</LinearGradientBrush>
</Button.Background>
</Button>
<Button Content="Credit Cards" HorizontalAlignment="Left" Margin="10,400,0,0" VerticalAlignment="Top" Width="140" RenderTransformOrigin="0.35,-0.455" Height="55" FontSize="14" FontWeight="Bold">
<Button.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="1"/>
</LinearGradientBrush>
</Button.Background>
</Button>
</Grid>
<Grid Grid.Column="1" HorizontalAlignment="Stretch" Height="530" Margin="10,3,0,0" Grid.Row="1" VerticalAlignment="Top" Width="auto" >
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFCFCFC" Offset="0.423"/>
<GradientStop Color="#FFEAEAEA" Offset="0.611"/>
<GradientStop Color="#FFFCFCFC" Offset="0.816"/>
<GradientStop Color="#FFFCFCFC" Offset="0.251"/>
</LinearGradientBrush>
</Grid.Background>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="323*"/>
<ColumnDefinition Width="33*"/>
<ColumnDefinition Width="496*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="43*"/>
<RowDefinition Height="359*"/>
<RowDefinition Height="20*">
<RowDefinition.BindingGroup>
<BindingGroup/>
</RowDefinition.BindingGroup>
</RowDefinition>
<RowDefinition Height="95*"/>
</Grid.RowDefinitions>
<TextBox Grid.Row="0" HorizontalAlignment="Left" Height="36" Margin="174,6,0,0" TextWrapping="Wrap" Text="Qiuck Find Customer, Item ,Receipt, Help and more" VerticalAlignment="Top" Width="auto" FontStyle="Italic" RenderTransformOrigin="0.502,0.239" Grid.ColumnSpan="3"/>
<Grid HorizontalAlignment="Left" Height="344" Margin="30,4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="286" RenderTransformOrigin="0.447,0.514">
<Grid.Effect>
<DropShadowEffect/>
</Grid.Effect>
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFDFE8F5" Offset="0.504"/>
<GradientStop Color="#FFFAFBFC" Offset="0.726"/>
<GradientStop Color="#FFDFE9F5" Offset="0.322"/>
</LinearGradientBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="38*"/>
<RowDefinition Height="266*" />
<RowDefinition Height="37*"/>
</Grid.RowDefinitions>
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-0.177"/>
<TranslateTransform/>
</TransformGroup>
</Grid.RenderTransform>
<TextBox Grid.Row="0" HorizontalAlignment="Left" Height="23" Margin="88,10,0,0" TextWrapping="Wrap" Text="Search Message" VerticalAlignment="Top" Width="186" RenderTransformOrigin="0.489,0.419" FontStyle="Italic"/>
<Label Grid.Row="0" Content="Message" HorizontalAlignment="Left" Margin="13,10,0,0" VerticalAlignment="Top"/>
<Button Grid.Row="2" Content="New" HorizontalAlignment="Left" Margin="13,3,0,0" VerticalAlignment="Top" Width="58" RenderTransformOrigin="0.35,-0.455" Height="19" FontWeight="Bold" FontSize="10">
<Button.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="0.5"/>
<GradientStop Color="#FF7590D3" Offset="1"/>
</LinearGradientBrush>
</Button.Background>
</Button>
<TextBlock Grid.Row="2" HorizontalAlignment="Left" Margin="213,10,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top">
<Hyperlink NavigateUri="" >Show List</Hyperlink>
</TextBlock>
<ScrollViewer Height="216" Grid.Row="1" Margin="0,10,0,0" >
<StackPanel>
<RichTextBox HorizontalAlignment="Left" Height="162" Margin="40,27,0,0" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Grid.Row="1">
<RichTextBox.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-12.787"/>
<TranslateTransform/>
</TransformGroup>
</RichTextBox.RenderTransform>
<FlowDocument>
<Paragraph>
<Run Text="RichTextBox"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
<RichTextBox HorizontalAlignment="Left" Height="172" Margin="40,27,0,0" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Grid.Row="1" Grid.RowSpan="2">
<RichTextBox.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-12.787"/>
<TranslateTransform/>
</TransformGroup>
</RichTextBox.RenderTransform>
<FlowDocument>
<Paragraph>
<Run Text="RichTextBox"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</StackPanel>
</ScrollViewer>
</Grid>
<GridSplitter Grid.Column="1" HorizontalAlignment="Left" Height="280" Margin="10,10,0,0" Grid.Row="1" VerticalAlignment="Top" Width="5" Background="#FFE7E7E7"/>
<Grid Grid.Column="2" HorizontalAlignment="Left" Height="345" Margin="10,4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="476">
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFE1EAF6" Offset="0.51"/>
<GradientStop Color="#FFF8FAFC" Offset="0.636"/>
</LinearGradientBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="28*"/>
<RowDefinition Height="16*"/>
<RowDefinition Height="32*"/>
<RowDefinition Height="46*"/>
<RowDefinition Height="24*"/>
<RowDefinition Height="45*"/>
<RowDefinition Height="21*"/>
<RowDefinition Height="44*"/>
<RowDefinition Height="21*"/>
<RowDefinition Height="63*"/>
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Left" Margin="20,5,0,0" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="16" Height="21" Width="116">
<Hyperlink NavigateUri="http://search.msn.com" FontWeight="ExtraBlack">Getting Started</Hyperlink>
</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="180,5,0,0" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="16" RenderTransformOrigin="0.774,0.578" Height="21" Width="85">
<Hyperlink NavigateUri="http://search.msn.com" FontWeight="ExtraBlack">Navigator</Hyperlink>
</TextBlock>
<GridSplitter HorizontalAlignment="Left" Height="18" Margin="162,10,0,0" VerticalAlignment="Top" Width="2" Background="Gray"/>
<GridSplitter HorizontalAlignment="Left" Height="438" Margin="234,-183,0,0" VerticalAlignment="Top" Width="4" RenderTransformOrigin="0.5,0.5" Grid.RowSpan="8" Background="Gray">
<GridSplitter.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="90"/>
<TranslateTransform/>
</TransformGroup>
</GridSplitter.RenderTransform>
</GridSplitter>
<TextBlock HorizontalAlignment="Left" Margin="20,10,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Welcome to Quick Book Point Of Sales 10.0 " VerticalAlignment="Top" FontSize="16" FontWeight="Bold" Foreground="Gray" Height="21" Width="331"/>
<TextBlock HorizontalAlignment="Left" Margin="20,10,0,0" Grid.Row="3" TextWrapping="Wrap" Text="Ringing up your first sale " VerticalAlignment="Top" FontSize="14" FontWeight="SemiBold" Foreground="Gray" Height="19" Width="163"/>
<TextBlock HorizontalAlignment="Left" Margin="20,29,0,0" Grid.Row="3" TextWrapping="Wrap" Text="Learn how to make a sale, take a payment and print a receipt." VerticalAlignment="Top" Width="331" Height="14" Foreground="#FFB5A99C"/>
<TextBlock HorizontalAlignment="Left" Margin="280,2,0,0" Grid.Row="4" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="20" Width="89">
<Hyperlink NavigateUri="http:www.google.com.pk">Make a sale now</Hyperlink>
</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="385,2,0,0" Grid.Row="4" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="20" Width="89">
<Hyperlink NavigateUri="http:www.google.com.pk">Learn more</Hyperlink>
</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="20,8,0,0" Grid.Row="5" TextWrapping="Wrap" Text="Adding Items " VerticalAlignment="Top" FontSize="14" FontWeight="SemiBold" Foreground="Gray" Height="19" Width="163"/>
<TextBlock HorizontalAlignment="Left" Margin="20,28,0,0" Grid.Row="5" TextWrapping="Wrap" Text="Learn how to add items to your inventory." VerticalAlignment="Top" Width="331" Height="14" Foreground="#FFB5A99C" RenderTransformOrigin="0.47,4.735"/>
<TextBlock HorizontalAlignment="Left" Margin="280,3,0,0" Grid.Row="6" TextWrapping="Wrap" Text="" VerticalAlignment="Top" RenderTransformOrigin="0.544,-0.568" Width="89">
<Hyperlink NavigateUri="http:www.google.com.pk">Open the item list</Hyperlink>
</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="385,2,0,0" Grid.Row="6" TextWrapping="Wrap" Text="" VerticalAlignment="Top">
<Hyperlink NavigateUri="">Learn More</Hyperlink>
</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="20,2,0,0" Grid.Row="7" TextWrapping="Wrap" Text="Customizing Point of sale " VerticalAlignment="Top" FontSize="14" FontWeight="SemiBold" Foreground="Gray" Height="19" Width="163"/>
<TextBlock HorizontalAlignment="Left" Margin="20,22,0,0" Grid.Row="7" TextWrapping="Wrap" Text="Learn how to add items to your inventory." VerticalAlignment="Top" Width="331" Height="14" Foreground="#FFB5A99C" RenderTransformOrigin="0.47,4.735"/>
<TextBlock HorizontalAlignment="Left" Margin="280,3,0,0" Grid.Row="8" TextWrapping="Wrap" Text="" VerticalAlignment="Top">
<Hyperlink NavigateUri="">Open preferences</Hyperlink>
</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="385,3,0,0" Grid.Row="8" TextWrapping="Wrap" Text="" VerticalAlignment="Top">
<Hyperlink NavigateUri="">Learn More</Hyperlink>
</TextBlock>
</Grid>
<TextBlock HorizontalAlignment="Left" Margin="414,2,0,0" Grid.Row="2" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Grid.Column="2">
<Hyperlink NavigateUri="">Close</Hyperlink>
</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="106,18,0,0" Grid.Row="3" TextWrapping="Wrap" Text="Accepted Credit Cards " VerticalAlignment="Top" Width="213" FontSize="20" FontWeight="Bold" Foreground="#FF5C7B3C"/>
<TextBlock HorizontalAlignment="Left" Margin="106,62,0,0" Grid.Row="3" TextWrapping="Wrap" Text="Save time and money.Accept credit cards directly in Point of Sale. " VerticalAlignment="Top" Grid.ColumnSpan="3" Width="353" Height="22"/>
<TextBlock Grid.Column="2" HorizontalAlignment="Left" Margin="106,62,0,0" Grid.Row="3" TextWrapping="Wrap" Text="" VerticalAlignment="Top">
<Hyperlink NavigateUri="">Learn More</Hyperlink>
</TextBlock>
</Grid>
</Grid>
答案 0 :(得分:1)
据我的评论所知,您希望窗口包含其内容。您可以对网格使用HorizontalAlignment="Stretch"
和VerticalAlignment="Stretch"
,以便在窗口调整大小时拉伸它们。另外,尽可能避免使用Height="34"
等固定值来使其“响应”#34;有关Grid
的更多指导,请参阅以下链接。