- 浏览: 4334350 次
- 性别:
- 来自: 湛江
博客专栏
-
SQLite源码剖析
浏览量:79431
-
WIN32汇编语言学习应用...
浏览量:68393
-
神奇的perl
浏览量:101518
-
lucene等搜索引擎解析...
浏览量:281242
-
深入lucene3.5源码...
浏览量:14613
-
VB.NET并行与分布式编...
浏览量:65595
-
silverlight 5...
浏览量:31323
-
算法下午茶系列
浏览量:45219
文章分类
最新评论
-
yoyo837:
counters15 写道目前只支持IE吗?插件的东西是跨浏览 ...
Silverlight 5 轻松开启绚丽的网页3D世界 -
shuiyunbing:
直接在前台导出方式:excel中的单元格样式怎么处理,比如某行 ...
Flex导出Excel -
di1984HIT:
写的很好~
lucene入门-索引网页 -
rjguanwen:
在win7 64位操作系统下,pygtk的Entry无法输入怎 ...
pygtk-entry -
ldl_xz:
http://www.9958.pw/post/php_exc ...
PHPExcel常用方法汇总(转载)
一、首先构造以下界面
<UserControl x:Class="SilverlightApplication3.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"> <Grid x:Name="LayoutRoot" Background="White"> <Button Content="Button" Height="30" HorizontalAlignment="Left" Margin="145,179,0,0" Name="Button1" VerticalAlignment="Top" Width="127" /> <StackPanel Height="83" HorizontalAlignment="Left" Margin="134,90,0,0" Name="StackPanel1" VerticalAlignment="Top" Width="155"> <TextBlock Height="23" Name="TextBlock1" Text="深未来图形按钮" FontFamily="Portable User Interface" /> <Image Height="60" Name="Image1" Stretch="Fill" Width="155" Source="/SilverlightApplication3;component/Images/Tulips.jpg" /> </StackPanel> </Grid> </UserControl>
二、我们将除开button控件以外的东东全部放到button控件内
首先,将button的XAMl修改一下
<UserControl x:Class="SilverlightApplication3.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"> <Grid x:Name="LayoutRoot" Background="White"> <Button Height="102" HorizontalAlignment="Left" Margin="87,142,0,0" Name="Button1" VerticalAlignment="Top" Width="184"> <Button.Content> </Button.Content> </Button> <StackPanel Height="83" HorizontalAlignment="Left" Margin="0,0,0,0" Name="StackPanel1" VerticalAlignment="Top" Width="155"> <TextBlock Height="23" Name="TextBlock1" Text="深未来图形按钮" FontFamily="Portable User Interface" /> <Image Height="60" Name="Image1" Stretch="Fill" Width="155" Source="/SilverlightApplication3;component/Images/Tulips.jpg" /> </StackPanel> </Grid> </UserControl>
然后将StackPanel 的内容放到button来
<UserControl x:Class="SilverlightApplication3.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"> <Grid x:Name="LayoutRoot" Background="White"> <Button Height="102" HorizontalAlignment="Left" Margin="87,142,0,0" Name="Button1" VerticalAlignment="Top" Width="184"> <Button.Content> <StackPanel Height="83" HorizontalAlignment="Left" Margin="0,0,0,0" Name="StackPanel1" VerticalAlignment="Top" Width="155"> <TextBlock Height="23" Name="TextBlock1" Text="深未来图形按钮" FontFamily="Portable User Interface" /> <Image Height="60" Name="Image1" Stretch="Fill" Width="155" Source="/SilverlightApplication3;component/Images/Tulips.jpg" /> </StackPanel> </Button.Content> </Button> </Grid> </UserControl>
三、定义好样式与模板
<UserControl.Resources> <Style x:Key="dpbutton" TargetType="Button" > <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources>
然后将刚才的内容加入模板中
<UserControl x:Class="SilverlightApplication3.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" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"> <UserControl.Resources> <Style x:Key="dpbutton" TargetType="Button" > <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Button Height="102" HorizontalAlignment="Left" Margin="78,31,0,0" Name="Button1" VerticalAlignment="Top" Width="184"> <Button.Content> <StackPanel Height="83" HorizontalAlignment="Left" Margin="0,0,0,0" Name="StackPanel1" VerticalAlignment="Top" Width="155"> <TextBlock Height="23" Name="TextBlock1" Text="深未来图形按钮" FontFamily="Portable User Interface" /> <Image Height="60" Name="Image1" Stretch="Fill" Width="155" Source="/SilverlightApplication3;component/Images/Tulips.jpg" /> </StackPanel> </Button.Content> </Button> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources> </UserControl>
四、应用样式和模板
<UserControl x:Class="SilverlightApplication3.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">
<UserControl.Resources>
<Style x:Key="dpbutton" TargetType="Button" >
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Button Height="102" HorizontalAlignment="Left" Margin="78,31,0,0" Name="Button1" VerticalAlignment="Top" Width="184">
<Button.Content>
<StackPanel Height="83" HorizontalAlignment="Left" Margin="0,0,0,0" Name="StackPanel1" VerticalAlignment="Top" Width="155">
<TextBlock Height="23" Name="TextBlock1" Text="深未来图形按钮" FontFamily="Portable User Interface" />
<Image Height="60" Name="Image1" Stretch="Fill" Width="155" Source="/SilverlightApplication3;component/Images/Tulips.jpg" />
</StackPanel>
</Button.Content>
</Button>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<Button Style="{StaticResource dpbutton}" Height="141" HorizontalAlignment="Left" Margin="12,0,0,0" Name="Button1" VerticalAlignment="Top" Width="302" />
</Grid>
</UserControl>
我们最后加入2个这样的图形button,看看效果
<UserControl x:Class="SilverlightApplication3.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">
<UserControl.Resources>
<Style x:Key="dpbutton" TargetType="Button" >
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Button Height="102" HorizontalAlignment="Left" Margin="78,31,0,0" Name="Button1" VerticalAlignment="Top" Width="184">
<Button.Content>
<StackPanel Height="83" HorizontalAlignment="Left" Margin="0,0,0,0" Name="StackPanel1" VerticalAlignment="Top" Width="155">
<TextBlock Height="23" Name="TextBlock1" Text="深未来图形按钮" FontFamily="Portable User Interface" />
<Image Height="60" Name="Image1" Stretch="Fill" Width="155" Source="/SilverlightApplication3;component/Images/Tulips.jpg" />
</StackPanel>
</Button.Content>
</Button>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<Button Style="{StaticResource dpbutton}" Height="148" HorizontalAlignment="Left" Margin="12,0,0,0" Name="Button1" VerticalAlignment="Top" Width="300" />
<Button Height="148" HorizontalAlignment="Left" Margin="12,130,0,0" Name="Button2" Style="{StaticResource dpbutton}" VerticalAlignment="Top" Width="300" />
</Grid>
</UserControl>
发表评论
-
vb.net-picturebox输出文本
2012-07-17 17:33 1722Dim mypic As PictureBox = my ... -
VB.NET并行与分布式编程(11)-重叠 I/O
2012-06-07 17:12 2089NativeOverlapped 结构 提供一种显式布局,它 ... -
VB.NET并行与分布式编程(10)-关于栅栏
2012-06-07 11:11 1409一、临界域 Thread.BeginCriticalRegi ... -
VB.NET并行与分布式编程(9)-异步编程设计模式
2012-06-07 10:49 3639一、并行基础 许多个人计算机和工作站都有两个或四个内核( ... -
VB.NET并行与分布式编程(8)-net 分布式计算环境
2012-06-06 17:35 1791更多请看 http://msdn.m ... -
VB.NET并行与分布式编程(7)-线程池[2]
2012-06-06 17:12 1858在此,我们仅以GetAvailableThreads为例: ... -
VB.NET并行与分布式编程(7)-线程池[1]
2012-06-05 17:30 3875一、CLR线程池管理2类线程 1、普通的工作线程 1)使用 ... -
VB.NET并行与分布式编程(6)-线程与内核同步[18]
2012-06-05 15:07 1705一、RegisterWaitForSingleObje ... -
VB.NET并行与分布式编程(6)-线程与内核同步[17]
2012-06-04 17:01 1419ReaderWriterLockSlim.EnterUpgra ... -
VB.NET并行与分布式编程(6)-线程与内核同步[16]
2012-06-04 15:44 1353Imports System Imports System. ... -
VB.NET并行与分布式编程(6)-线程与内核同步[15]
2012-06-04 12:02 1318ReaderWriterLockSlim类是.NET框架提供的 ... -
vb.net 计算组合
2012-06-01 09:08 1298Private Function compute(ByVa ... -
vb.net 之arraylist
2012-05-24 17:29 3239'读文件 ... -
VB.NET并行与分布式编程(6)-线程与内核同步[14]
2012-05-18 10:21 1921Imports System Imports System. ... -
VB.NET并行与分布式编程(6)-线程与内核同步[13]
2012-05-17 15:46 1444Imports System Imports System. ... -
VB.NET并行与分布式编程(6)-线程与内核同步[12]
2012-05-17 12:18 1608我们还可以使用信号量来完成同步 Semaphore ... -
VB.NET并行与分布式编程(6)-线程与内核同步[11]
2012-05-15 17:45 1313Imports System Imports System. ... -
VB.NET并行与分布式编程(6)-线程与内核同步[10]
2012-05-15 15:22 1761E)代码分析 上节代码是最简单的异步调用代码,即调用委托的 ... -
VB.NET并行与分布式编程(6)-线程与内核同步[9]
2012-05-15 11:50 14063)使用委托的异步调用实现多线程的参数转入和传出 A)基础知 ... -
VB.NET并行与分布式编程(6)-线程与内核同步[8]
2012-05-11 11:05 15612)我们可以用更好的方式使用.NET的委托和线程池 A)委托 ...
相关推荐
C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手
Silverlight 5 开发工具包- 中文
C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手
C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手
C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手
C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手
C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手
C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手
C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手
Pro Silverlight 5 in C# - MacDonald - Apress (2012)
包括Silverlight4和Silverlight5的开发包和安装说明
HDI-Silverlight-2b1 - IntroducingBlendToSLDevs-SRC-CS.zip Silverlight 源码
HDI-Silverlight-2b2-GraphicsAndBrushes-CSharp.zip Silverlight 源码
HDI-Silverlight-2b1-ProgSLWithBlendDBinding-SRC-CS.zip Silverlight 源码
HDI-Silverlight-2b2-InStateAnimation-SRC-CSharp.zip Silverlight 源码
Source-Silverlight-2b1-Keyboard-SRC.zip Silverlight源码
SourceCode-Silverlight-2b1-Styles-SRC.zip Silverlight 源码
HDI-Silverlight-2b2-MultiPage-Part2-SRC-CSharp.zip Silverlight 源码
银光志--Silverlight 3.0开发详解与最佳实践-第3章光盘源码 对于一些B/S程序员来说,这些看似在B/S应用程序中简单的范例,在Silverlight中你会发现它们十分相似,但实现的过程确截然不同。因为这是RIA开发,RIA中...
HDI-Silverlight-2b1-IntroBlendForProgrammers-Part2.SRC-CSharp.zip Silverlight 源码