国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > HTML > 正文

XAML中Button重繪為圓形的方法技巧

2019-10-26 17:05:46
字體:
來源:轉載
供稿:網友
在用XAML布局的時候,有時候為了使界面Metro化,有些Button要使用圓形代替默認的長方形。以下的Button樣式可以解決這個問題,可以根據自己的需要再加以修改。當然如果你熟悉Bland的話可以直接使用它來繪制你需要的樣式,但是貼代碼是否更快一點呢?

復制代碼
代碼如下:
<Style x:Key="btnNext" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="rectangle">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Thickness>-3</Thickness>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal"/>
<VisualState x:Name="Disabled"/>
<VisualState x:Name="MouseOver"/>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Rectangle x:Name="rectangle" RadiusY="25" RadiusX="25" Stroke="Blue" StrokeThickness="4">
</Rectangle>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Margin" Value="5"/>
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="50"/>
<Setter Property="FontSize" Value="120"/>
<Setter Property="Foreground" Value="White"/>
</Style>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 镇雄县| 宾阳县| 桃园市| 宁波市| 金乡县| 崇义县| 沿河| 措勤县| 抚松县| 安吉县| 明溪县| 德格县| 江川县| 嵩明县| 巫山县| 湖口县| 大余县| 灵丘县| 玛纳斯县| 浮山县| 德清县| 大兴区| 普兰县| 梁河县| 射洪县| 南陵县| 古浪县| 江华| 天长市| 石门县| 阳高县| 重庆市| 报价| 长泰县| 汉源县| 深圳市| 柳河县| 宁国市| 北碚区| 龙川县| 油尖旺区|