开发工具与关键技术:Visual Studio
今天教大家用WPF做window窗口快速创建表格;
下面我们来看一下代码,
<Window x:Class="Client.View.Order_editing"
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:Client.View"
Icon="/Icon/icon.png"
Title="订单编辑" Height="500" Width="1100"
WindowStartupLocation="CenterScreen"
ResizeMode="NoResize"
BorderThickness="1" BorderBrush="White" Background="White" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="49*"/>
<RowDefinition Height="25*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="80*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="20*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.4*"/>
<ColumnDefinition Width="1.15*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Border Width="1080" Height="458" HorizontalAlignment="Center" VerticalAlignment="Top" CornerRadius="15" Grid.RowSpan="11" Grid.ColumnSpan="4">
<Border.Background>
<ImageBrush ImageSource="/Client;component/images/upbei.png"/>
</Border.Background>
</Border>
<Border BorderThickness="1" BorderBrush="Gray" CornerRadius="15,15,15,15" Grid.ColumnSpan="4" Grid.RowSpan="11" />
<Border BorderThickness="0 0 0 2" Width="1080" Height="50" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,1,0,0" CornerRadius="15,15,0,0" Grid.ColumnSpan="4" BorderBrush="Gray">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF7AB4FB" Offset="0.992"/>
<GradientStop Color="#FFC8FCFF"/>
<GradientStop Color="#FF83BCFB" Offset="0.94"/>
<GradientStop Color="#FFB9EEFE" Offset="0.193"/>
</LinearGradientBrush>
</Border.Background>
</Border>
<Button Name="btn_xinzeng" Content="新增" Height="30" Width="60" FontSize="16" Cursor="Hand" Foreground="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,10,0,0" Padding="2" BorderBrush="{x:Null}">
<Button.Background>
<ImageBrush ImageSource="/Client;component/Icon/anniu.png"/>
</Button.Background>
</Button>
<Button Name="btn_xiugai" Content="保存" Height="30" Width="60" FontSize="16" Cursor="Hand" Foreground="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="100,10,0,0" Padding="2" BorderBrush="{x:Null}">
<Button.Background>
<ImageBrush ImageSource="/Client;component/Icon/anniu.png"/>
</Button.Background>
</Button>
<Button Name="btn_dayin" Content="打印" Height="30" Width="60" FontSize="16" Cursor="Hand" Foreground="Black"