zoukankan      html  css  js  c++  java
  • 2、DockPanel

    DockPanel——停靠面板,内部控件或容器可以放置在上、下、左(默认)、右。类似于Java AWT布局中的BorderLayout。

    但与BorderLayout不同的是,每一个区域可以同时放置多个控件(布局方式为StackPanel)。

    内部元素(控件、容器)出场顺序很重要,最后出场的会把剩余空间占满(此元素不设置对齐方式、宽高)。后出场的只能在剩余空间里独占行或列。

    左图中,后出场的TextBox把DockPanel的上部占满了。右图是TextBox先出场、StackPanel后出场的效果。

      

    <DockPanel>
            <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Content="确定" Margin="5"/>
                <Button Content="取消" Margin="5"/>
            </StackPanel>
            <TextBox DockPanel.Dock="Top" Text="1234"/>
    </DockPanel>

     下图,后出场的这能在剩余的空间中独占行(上下)或列(左右)

        <DockPanel >
            <Button Content="Top1" DockPanel.Dock="Top" />
            <Button Content="Top2" DockPanel.Dock="Top" HorizontalAlignment="Right"/>
            <Button Content="Top3" DockPanel.Dock="Top" />
            <Button Content="Left" DockPanel.Dock="Left" />
            <Button Content="Right" DockPanel.Dock="Right" />
            <Button Content="Bottom" DockPanel.Dock="Bottom" />
            <Button Content="Remaining" />
        </DockPanel>
  • 相关阅读:
    ASP.NET
    jquery
    rowcommand事件中获取控件
    Net 自定义Excel模板导出数据
    代码阅读方法与实践---阅读笔记06
    代码阅读方法与实践---阅读笔记05
    代码阅读方法与实践---阅读笔记04
    软件需求十步走---阅读笔记03
    软件需求十步走---阅读笔记02
    软件需求十步走---阅读笔记01
  • 原文地址:https://www.cnblogs.com/xixixing/p/10962661.html
Copyright © 2011-2022 走看看