濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > XAML中Button重繪為圓形的方法技巧

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

熱門(mén)標(biāo)簽:AI外呼系統(tǒng) 價(jià)格 錦州企業(yè)外呼系統(tǒng) 最簡(jiǎn)單的百度地圖標(biāo)注店鋪 梧州地圖標(biāo)注app 禹州電話外呼系統(tǒng) 青海保險(xiǎn)智能外呼系統(tǒng)商家 營(yíng)口400電話申請(qǐng) 新鄉(xiāng)機(jī)器人外呼系統(tǒng) 水經(jīng)注萬(wàn)能地圖標(biāo)注
在用XAML布局的時(shí)候,有時(shí)候?yàn)榱耸菇缑鍹etro化,有些Button要使用圓形代替默認(rèn)的長(zhǎng)方形。以下的Button樣式可以解決這個(gè)問(wèn)題,可以根據(jù)自己的需要再加以修改。當(dāng)然如果你熟悉Bland的話可以直接使用它來(lái)繪制你需要的樣式,但是貼代碼是否更快一點(diǎn)呢?

復(fù)制代碼
代碼如下:

<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>

標(biāo)簽:山南 懷化 青島 荊門(mén) 延邊 哈密 潮州 昭通

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《XAML中Button重繪為圓形的方法技巧》,本文關(guān)鍵詞  XAML,中,Button,重繪,為,圓,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《XAML中Button重繪為圓形的方法技巧》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于XAML中Button重繪為圓形的方法技巧的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    上蔡县| 犍为县| 渑池县| 岳阳市| 普宁市| 武陟县| 兴安盟| 阜新| 崇礼县| 英山县| 万安县| 塔城市| 遵义市| 晋江市| 佛坪县| 达尔| 兴和县| 康平县| 车险| 兴化市| 南通市| 淮南市| 西乌珠穆沁旗| 张家口市| 盐城市| 临朐县| 东至县| 唐海县| 和田县| 安塞县| 姚安县| 六安市| 平罗县| 庆城县| 平泉县| 平原县| 澄江县| 武邑县| 密山市| 德昌县| 廊坊市|