`
deepfuture
  • 浏览: 4334411 次
  • 性别: Icon_minigender_1
  • 来自: 湛江
博客专栏
073ec2a9-85b7-3ebf-a3bb-c6361e6c6f64
SQLite源码剖析
浏览量:79435
1591c4b8-62f1-3d3e-9551-25c77465da96
WIN32汇编语言学习应用...
浏览量:68406
F5390db6-59dd-338f-ba18-4e93943ff06a
神奇的perl
浏览量:101528
Dac44363-8a80-3836-99aa-f7b7780fa6e2
lucene等搜索引擎解析...
浏览量:281251
Ec49a563-4109-3c69-9c83-8f6d068ba113
深入lucene3.5源码...
浏览量:14617
9b99bfc2-19c2-3346-9100-7f8879c731ce
VB.NET并行与分布式编...
浏览量:65601
B1db2af3-06b3-35bb-ac08-59ff2d1324b4
silverlight 5...
浏览量:31327
4a56b548-ab3d-35af-a984-e0781d142c23
算法下午茶系列
浏览量:45219
社区版块
存档分类
最新评论

silverlight 5开发【vb版】(10)- 布局控件

 
阅读更多

1、布局控件主要有canvas,grid,stackpanel

2、canvas提供了一个空白空间,是简单的,可以操作canvas.left和canvas.top来进行控件在canvas的位置

grid可以提供随着浏览器窗口大小改变自动调整其内的控件的位置等,将空间划分为多行和多列

stackpanel提供一个纵向或横向排列控件的机制

3、下面是一个使用了3个布局控件的例子

Partial Public Class MainPage
    Inherits UserControl

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
        Button1.SetValue(Canvas.TopProperty, 20.0)
    End Sub
End Class

 

<UserControl x:Class="SilverlightApplication1.MainPage"
    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"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" Margin="0">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="126" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="29" />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Canvas Height="90" HorizontalAlignment="Left" Margin="12,0,0,0" Name="Canvas1" VerticalAlignment="Top" Width="237" Grid.Row="3">
            <Button Content="Button" Height="29" Name="Button1" Width="94" Canvas.Left="63" Canvas.Top="37" />
        </Canvas>
        <StackPanel Grid.Row="1" Height="90" HorizontalAlignment="Left" Margin="21,0,0,0" Name="StackPanel1" VerticalAlignment="Top" Width="253">
            <CheckBox Content="CheckBox" Height="16" Name="CheckBox1" />
            <CheckBox Content="CheckBox" Height="16" Name="CheckBox2" />
            <CheckBox Content="CheckBox" Height="16" Name="CheckBox3" />
            <StackPanel Height="33" Name="StackPanel2" Width="226" Orientation="Horizontal">
                <Button Content="Button" Height="18" Name="Button4" Width="50" />
                <Button Content="Button" Height="23" Name="Button2" Width="75" />
                <Button Content="Button" Height="23" Name="Button3" Width="75" />
            </StackPanel>
        </StackPanel>
    </Grid>
</UserControl>

 

 



 

 

  • 大小: 37.8 KB
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics