久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

silverlight 之 – Blend 之圖形按鈕(四)

 Jcstone 2012-04-05

silverlight 之 – Blend 之圖形按鈕(四)

上一篇中我們搞定了藍(lán)色按鈕的樣式,同時準(zhǔn)備了很多色板,,

1. 我們自己發(fā)揮一下再做出一個灰色的按鈕:

截圖19

另外補充一下在編輯模板的時候,,發(fā)現(xiàn)有的屬性是鎖定的,由一個黃色的圈框鎖著:

截圖16 截圖20

這就表示這個屬性是由用戶控件在使用的時候定義的,,比如按鈕的邊框粗細(xì),背景色,文字,,對其等等;

如果這個屬性確實需要在模板里面改掉,,可以點擊后面的黃色點然后選擇“重置”,,這樣黃色的鎖定框就消失了;

2. 使用先畫出我們需要在按鈕上顯示的圖形,;

    》 選擇矩形工具,,畫出兩個矩形

    》 使用淡灰色填充,邊框不填充

    》 右鍵》 合并》相減

截圖21

    》 復(fù)制到剪貼板

截圖24

    》 進(jìn)入按鈕模板 

截圖23

    》 粘貼     

截圖25

   

》 調(diào)整效果如下:

截圖26

》把文字刪掉,,因為這個圖形按鈕用不著

截圖27

》 完成編輯,,回到原頁面效果如下:

截圖28

 

3. 同樣的制作如下按鈕直接放圖和代碼吧,實際上只要熟悉了操作應(yīng)該都是很簡單的,;但是要一步一步寫出來確很麻煩,;

截圖29

 

UserControlCard.xaml 代碼:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<Grid x:Name="LayoutRoot">
    <Rectangle Fill="{StaticResource FA}" Stroke="Black" Height="57" HorizontalAlignment="Left" VerticalAlignment="Top" Width="163"/>
    <Button Height="41" HorizontalAlignment="Left" Margin="23,7,0,0" Style="{StaticResource BlueButtonStyle}" VerticalAlignment="Top" Width="112" Content="by zhanxp" BorderThickness="2"/>
    <Rectangle Fill="{StaticResource FA}" Stroke="Black" Height="57" VerticalAlignment="Top" Margin="0,93,0,0" HorizontalAlignment="Left" Width="265"/>
    <Button Height="38" HorizontalAlignment="Left" Margin="23,103,0,0" VerticalAlignment="Top" Width="40" Content="Button" Style="{StaticResource GrayButtonStyle}" BorderThickness="2"/>
    <Path Fill="{StaticResource CD}" Stretch="Fill" Height="23" HorizontalAlignment="Left" Margin="28,168,0,0" VerticalAlignment="Top" Width="25" UseLayoutRounding="False" Data="M3.9999971,5.9999943 L3.9999971,19.999994 L20.999996,19.999994 L20.999996,5.9999943 z M0,0 L25,0 L25,23 L0,23 z"/>
    <Button Height="38" HorizontalAlignment="Left" Margin="80,103,0,0" Style="{StaticResource IconButton2}" VerticalAlignment="Top" Width="40" BorderThickness="2">
        <Rectangle Fill="{StaticResource FA}" Stroke="Black" Height="4" Width="24"/>
    </Button>
    <Button Height="38" HorizontalAlignment="Left" Margin="137,103,0,0" Style="{StaticResource IconButtonStyle2}" VerticalAlignment="Top" Width="40" Content="Button" BorderThickness="2"/>
    <Button Height="38" HorizontalAlignment="Left" Margin="198,103,0,0" Style="{StaticResource IconButtonStyle3}" VerticalAlignment="Top" Width="40" Content="Button" BorderThickness="2"/>
    <Path Fill="{StaticResource CD}" Stretch="Fill" Height="24" HorizontalAlignment="Left" Margin="88,168,0,0" VerticalAlignment="Top" Width="24" UseLayoutRounding="False" Data="M16,0 L24,0 L24,16.000008 L40,16.000008 L40,24.000008 L24,24.000008 L24,40 L16,40 L16,24.000008 L0,24.000008 L0,16.000008 L16,16.000008 z"/>
    <Path Fill="{StaticResource CD}" Stretch="Fill" Height="22.833" HorizontalAlignment="Left" Margin="146.667,168.167,0,0" VerticalAlignment="Top" Width="21.333" UseLayoutRounding="False" Data="M144.16599,168.16701 L143.99966,191.00034 L165.33321,180.00017 z"/>
    <Path Fill="{StaticResource CD}" Stretch="Fill" Height="22.833" HorizontalAlignment="Left" Margin="212,168.667,0,0" VerticalAlignment="Top" Width="19.917" UseLayoutRounding="False" Data="M144.16599,168.16701 L143.99966,191.00034 L168.56673,179.66718 z" RenderTransformOrigin="0.5,0.5">
        <Path.RenderTransform>
            <TransformGroup>
                <ScaleTransform ScaleX="-1"/>
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform X="-1"/>
            </TransformGroup>
        </Path.RenderTransform>
    </Path>
</Grid>

Style.xaml 新增代碼:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<Style x:Key="GrayButtonStyle" TargetType="Button">
        <Setter Property="Background" Value="#FF1F3B53"/>
        <Setter Property="Foreground" Value="#FF000000"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9" Offset="0"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background" Background="{StaticResource FB}" BorderBrush="{StaticResource FE}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
                            <Grid Margin="0">
                                <Border x:Name="BackgroundAnimation" Opacity="0"/>
                                <Rectangle x:Name="BackgroundGradient" Fill="{StaticResource FB}" Opacity="0.55" RadiusX="2" RadiusY="4" StrokeThickness="0"/>
                            </Grid>
                        </Border>
                        <Rectangle x:Name="DisabledVisualElement" RadiusX="3" RadiusY="3" IsHitTestVisible="false" Opacity="0"/>
                        <Rectangle x:Name="FocusVisualElement" StrokeThickness="1" RadiusX="2" RadiusY="2" Margin="1" IsHitTestVisible="false" Opacity="0" Stroke="Black"/>
                        <Path Fill="{StaticResource CD}" Stretch="Fill" Height="23" HorizontalAlignment="Left" Margin="8,0,0,0" VerticalAlignment="Center" Width="25" UseLayoutRounding="False" Data="M3.9999971,5.9999943 L3.9999971,19.999994 L20.999996,19.999994 L20.999996,5.9999943 z M0,0 L25,0 L25,23 L0,23 z"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="IconButton2" TargetType="Button">
        <Setter Property="Background" Value="#FF1F3B53"/>
        <Setter Property="Foreground" Value="#FF000000"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9" Offset="0"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background" Background="{StaticResource FB}" BorderBrush="{StaticResource FE}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
                            <Grid Margin="0">
                                <Border x:Name="BackgroundAnimation" Opacity="0"/>
                                <Rectangle x:Name="BackgroundGradient" Fill="{StaticResource FB}" StrokeThickness="0" RadiusX="2" RadiusY="4" Opacity="0.55"/>
                            </Grid>
                        </Border>
                        <Rectangle x:Name="DisabledVisualElement" RadiusX="3" RadiusY="3" IsHitTestVisible="false" Opacity="0"/>
                        <Rectangle x:Name="FocusVisualElement" Stroke="Black" StrokeThickness="1" RadiusX="2" RadiusY="2" Margin="1" IsHitTestVisible="false" Opacity="0"/>
                        <Path Fill="{StaticResource CD}" Stretch="Fill" Height="23" HorizontalAlignment="Left" Margin="8,0,0,0" Width="23" UseLayoutRounding="False" Data="M16,0 L24,0 L24,16.000008 L40,16.000008 L40,24.000008 L24,24.000008 L24,40 L16,40 L16,24.000008 L0,24.000008 L0,16.000008 L16,16.000008 z"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="IconButtonStyle2" TargetType="Button">
        <Setter Property="Background" Value="#FF1F3B53"/>
        <Setter Property="Foreground" Value="#FF000000"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9" Offset="0"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background" Background="{StaticResource FB}" BorderBrush="{StaticResource FE}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
                            <Grid Margin="0">
                                <Border x:Name="BackgroundAnimation" Opacity="0"/>
                                <Rectangle x:Name="BackgroundGradient" Fill="{StaticResource FB}" StrokeThickness="0" RadiusX="2" RadiusY="4" Opacity="0.55"/>
                            </Grid>
                        </Border>
                        <Rectangle x:Name="DisabledVisualElement" RadiusX="3" RadiusY="3" IsHitTestVisible="false" Opacity="0"/>
                        <Rectangle x:Name="FocusVisualElement" Stroke="Black" StrokeThickness="1" RadiusX="2" RadiusY="2" Margin="1" IsHitTestVisible="false" Opacity="0"/>
                        <Path Fill="{StaticResource CD}" Stretch="Fill" Height="22.833" HorizontalAlignment="Left" VerticalAlignment="Center" Width="21.333" UseLayoutRounding="False" Data="M144.16599,168.16701 L143.99966,191.00034 L165.33321,180.00017 z" Margin="10,0,0,0"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="IconButtonStyle3" TargetType="Button">
        <Setter Property="Background" Value="#FF1F3B53"/>
        <Setter Property="Foreground" Value="#FF000000"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9" Offset="0"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background" Background="{StaticResource FB}" BorderBrush="{StaticResource FE}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
                            <Grid Margin="0">
                                <Border x:Name="BackgroundAnimation" Opacity="0"/>
                                <Rectangle x:Name="BackgroundGradient" Fill="{StaticResource FB}" StrokeThickness="0" RadiusX="2" RadiusY="4" Opacity="0.55"/>
                            </Grid>
                        </Border>
                        <Rectangle x:Name="DisabledVisualElement" RadiusX="3" RadiusY="3" IsHitTestVisible="false" Opacity="0"/>
                        <Rectangle x:Name="FocusVisualElement" Stroke="Black" StrokeThickness="1" RadiusX="2" RadiusY="2" Margin="1" IsHitTestVisible="false" Opacity="0"/>
                        <Path Fill="{StaticResource CD}" Stretch="Fill" Height="22.833" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" Width="19.917" UseLayoutRounding="False" Data="M144.16599,168.16701 L143.99966,191.00034 L168.56673,179.66718 z" RenderTransformOrigin="0.5,0.5">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform ScaleX="-1"/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                    <TranslateTransform X="-1"/>
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

 

 

silverlight 之 – Blend 一切源于Brush(一)

silverlight 之 – Blend 之 LinearGradientBrush (二)

silverlight 之 – Blend 之 Style for Button (三)

分類: Silverlight

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點,。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報,。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多