zoukankan      html  css  js  c++  java
  • 圆角button

    方案1:

       <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="yuanjiaoBtn" TargetType="{x:Type Button}">            
                <Border BorderBrush="Gray" BorderThickness="0.5" CornerRadius="12" Background="Black">
                    <ContentPresenter Content="{TemplateBinding ContentControl.Content}"/>
                </Border>    
                
            </ControlTemplate>
            <ControlTemplate  x:Key="CornerTextBox" TargetType="{x:Type TextBox}">
                <Border BorderBrush="Blue" BorderThickness="1" CornerRadius="10" Background="#FFD5F0D4">
                    <ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center"/>
                </Border>
            </ControlTemplate>
        </Window.Resources>
        <Canvas Background="#1b1b1b">
            <Button x:Name="btnOK" Content="OK" Template="{StaticResource CornerButton}" Height="26" Canvas.Top="175" Width="61" Canvas.Left="58" Click="btnOK_Click"></Button>
            <Button x:Name="btnCancel" Content="Cancel" Template="{StaticResource yuanjiaoBtn}" Height="26" Canvas.Top="175" Width="61" Canvas.Left="138"></Button>
            <TextBox Template="{StaticResource CornerTextBox}" Canvas.Left="74" Canvas.Top="50" Height="23" Name="textBox1" Width="120" Background="#FF7FBC7D" />
            <TextBox Template="{StaticResource CornerTextBox}" Canvas.Left="74" Canvas.Top="108" Height="23" Name="textBox2" Width="120" />
    </Canvas>
    方案2:
    <Button Content="地图" Height="50" Margin="555,282,466,393" Width="50">
        <Button.Template>
            <ControlTemplate TargetType="{x:Type Button}">
                <Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="3,13,3,13" Name="PART_Background">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                            <GradientStop Color="White" Offset="0.0" />
                            <GradientStop Color="Silver" Offset="0.5" />
                            <GradientStop Color="White" Offset="0.0" />
                        </LinearGradientBrush>
                    </Border.Background>
                    <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="UIElement.IsMouseOver" Value="True">
                        <Setter Property="Border.Background" TargetName="PART_Background">
                            <Setter.Value>
                                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                    <GradientStop Color="Silver" Offset="0.0" />
                                    <GradientStop Color="White" Offset="0.5" />
                                    <GradientStop Color="Silver" Offset="0.0" />
                                </LinearGradientBrush>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                    <Trigger Property="ButtonBase.IsPressed" Value="True">
                        <Setter Property="UIElement.Effect">
                            <Setter.Value>
                                <DropShadowEffect BlurRadius="10" Color="Black" Direction="0" Opacity="0.6" RenderingBias="Performance" ShadowDepth="0" />
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Button.Template>
    </Button>
  • 相关阅读:
    WCF 路由功能
    ado.net2.0的SqlTransaction使用方法
    IIS7、IIS8添加net.tcp协议报错 "未将对象引用设置到对象的实例。"
    windows phone 7 调用 wcf
    kettle连接mssql(Driver class 'net.sourceforge.jtds.jdbc.Driver' could not be found, make sure the 'MS SQL Server' driver (jar file) is installed)
    hive源码编译
    传奇1.76版本私服物品过滤单(去除祖玛级别)
    中国电信摘机系统xml
    初中英语
    视频播放器
  • 原文地址:https://www.cnblogs.com/joean/p/4847681.html
Copyright © 2011-2022 走看看