WPF控件6

GridSplitter(控件)分割线,表示重新分布 Grid 控件的列间距或行间距的控件

XAMl

<Grid>

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="1*"/>

            <ColumnDefinition Width="2*"/>

            <ColumnDefinition Width="3*"/>

        Grid.ColumnDefinitions>

        <GridSplitter Grid.Column="0" Background="LightGreen" Width="20"

                      HorizontalAlignment="Left">GridSplitter>

        <GridSplitter Grid.Column="0" Background="GreenYellow" Width="3"

                      HorizontalAlignment="Right">GridSplitter>

        <GridSplitter Grid.Column="1" Background="BlueViolet" Width="4"

                      HorizontalAlignment="Right">GridSplitter>

    Grid>

效果:

WPF控件6_第1张图片

 

C#

public GridSplitterDemo()

        {

            InitializeComponent();

            Init();

        }

        public void Init()

        {

            Grid myGrid = new Grid();

            // 定义的列,并设好比例1:1:2

            /*

             * GridUnitType.Pixel:绝对值

你可能感兴趣的:(wpf,.net)