zoukankan      html  css  js  c++  java
  • WPF布局(1) 使用StackPanel面板进行简单的布局

    StackPanel 面板是简单的布局容器。该面板简单地在单行或单列中以堆栈的形式放置其中的子元素,默认情况StackPanel是自上而下排列元素,标签和按钮的大小刚好足够适合它们内部包含的文本。,也可以设置Orientantion 属性,使StackPanel面板水平排列元素

    例如

    <Window x:Class="Project03_01StackPanel.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525">
        <Border Margin="5" Padding="5" Background="LightYellow" BorderBrush="SteelBlue"
                BorderThickness="3,5,3,5" CornerRadius="3">
        <StackPanel >
            <Label HorizontalAlignment="Center">A Button Stack</Label>
            <Button Margin="3" MaxWidth="200"  MinWidth="100" HorizontalAlignment="Left">Button 1</Button>
            <Button Margin="3" MaxWidth="200" MinWidth="100" HorizontalAlignment="Right">Button 2</Button>
            <Button Margin="3" MaxWidth="200" MinWidth="100">Button 3</Button>
            <Button Margin="3" MaxWidth="200" MinWidth="100">Button 4</Button>
        </StackPanel>
        </Border>
    </Window>
    效果图:
    image
  • 相关阅读:
    springcloud之consul
    git学习创建项目仓库
    学习vue之路V1.0.0
    使用jquery+ajax+php实现搜索框的功能
    发现一个vue的UI组件库
    一个菜鸟用webpack-vue.js编译过程碰到的坑~~!!
    学习vue之路
    typescript入门
    计算机排序算法
    js中三种变量的声明方式const ; var ; let
  • 原文地址:https://www.cnblogs.com/WilliamJiang/p/2302722.html
Copyright © 2011-2022 走看看