标签:type 读者 resources ext resource order 文本 height source
<Window.Resources>
//对按钮的重写
<ControlTemplate x:Key="CornerButton" TargetType="{x:Type Button}">
<Border BorderBrush="Green" BorderThickness="1" CornerRadius="10" Background="Red">
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border> </ControlTemplate>
//此段代码是对按钮的重写
//对文本框的重写
<ControlTemplate x:Key="CornerTextBox" TargetType="{x:Type TextBox}">
<Border BorderBrush="#00ff00" BorderThickness="1" CornerRadius="10" Background="#fff">
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center"/>
</Border></ControlTemplate>
//此段代码是对文本框的重写
</Window.Resources>
<Canvas> //Canvas为WPF的面板控件
//写一个按钮为例,文本框写法类似
<Button x:Name="btnJS" Content="接收" Template="{StaticResource CornerButton}" Height="26" Canvas.Top="175" Width="61" Canvas.Left="218"></Button></Canvas>
标签:type 读者 resources ext resource order 文本 height source
原文地址:http://www.cnblogs.com/ali-k/p/6905824.html