实例介绍
【实例简介】wpf 斗地主
【实例截图】
【核心代码】
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 | < Application x:Class = "TwoToOnePokerGame.App" StartupUri = "MainForm.xaml" > < Application.Resources > <!--统一的Expander样式--> < Style TargetType = "{x:Type Expander}" x:Key = "ExpanderStyle" > < Setter Property = "Background" > < Setter.Value > < LinearGradientBrush EndPoint = "0.472,0.992" StartPoint = "0.472,0.021" > < GradientStop Color = "#FF444533" Offset = "0" /> < GradientStop Color = "#FFF6F7E7" Offset = "1" /> </ LinearGradientBrush > </ Setter.Value > </ Setter > < Setter Property = "Padding" Value = "10" /> < Setter Property = "BorderBrush" Value = "DimGray" /> < Setter Property = "BorderThickness" Value = "1" /> < Setter Property = "IsExpanded" Value = "True" /> < Setter Property = "MinWidth" Value = "100" /> < Setter Property = "Margin" Value = "5" /> < Setter Property = "HorizontalContentAlignment" Value = "Stretch" /> < Setter Property = "Foreground" Value = "White" /> < Setter Property = "VerticalContentAlignment" Value = "Stretch" /> < Setter Property = "Template" > < Setter.Value > < ControlTemplate TargetType = "{x:Type Expander}" > < Grid > < Border BorderBrush = "{TemplateBinding Border.BorderBrush}" Margin = "1" CornerRadius = "3,3,3,3" BorderThickness = "{TemplateBinding Border.BorderThickness}" Background = "White" SnapsToDevicePixels = "True" > < Border.BitmapEffect > < DropShadowBitmapEffect Opacity = "0.5" /> </ Border.BitmapEffect > </ Border > < Border x:Name = "MainBorder" BorderBrush = "{TemplateBinding Border.BorderBrush}" CornerRadius = "3,3,3,3" BorderThickness = "{TemplateBinding Border.BorderThickness}" Background = "{TemplateBinding Panel.Background}" SnapsToDevicePixels = "True" > < DockPanel > < ToggleButton IsChecked = "{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" MinWidth = "0" Margin = "3" FontWeight = "{TemplateBinding TextElement.FontWeight}" HorizontalContentAlignment = "{TemplateBinding Control.HorizontalContentAlignment}" FontStretch = "{TemplateBinding TextElement.FontStretch}" VerticalContentAlignment = "{TemplateBinding Control.VerticalContentAlignment}" Foreground = "{TemplateBinding TextElement.Foreground}" FontFamily = "{TemplateBinding TextElement.FontFamily}" x:Name = "HeaderSite" FontStyle = "{TemplateBinding TextElement.FontStyle}" FontSize = "{TemplateBinding TextElement.FontSize}" MinHeight = "0" ContentTemplate = "{TemplateBinding HeaderedContentControl.HeaderTemplate}" Content = "{TemplateBinding HeaderedContentControl.Header}" DockPanel.Dock = "Top" > < ToggleButton.Template > < ControlTemplate TargetType = "{x:Type ToggleButton}" > < Border Padding = "{TemplateBinding Control.Padding}" > < Grid Background = "#00FFFFFF" SnapsToDevicePixels = "False" > < Grid.ColumnDefinitions > < ColumnDefinition Width = "19" /> < ColumnDefinition Width = "Auto" /> </ Grid.ColumnDefinitions > < Ellipse x:Name = "BackGrad" Height = "19" Width = "19" HorizontalAlignment = "Center" VerticalAlignment = "Center" StrokeThickness = "1" Stroke = "DarkBlue" > < Ellipse.Fill > < LinearGradientBrush StartPoint = "0,0" EndPoint = "0,1" > < GradientStop Color = "LightSkyBlue" Offset = "0" /> < GradientStop Color = "Blue" Offset = "0.5" /> < GradientStop Color = "LightSkyBlue" Offset = "1" /> </ LinearGradientBrush > </ Ellipse.Fill > </ Ellipse > < Ellipse Height = "19" Width = "19" HorizontalAlignment = "Center" VerticalAlignment = "Center" Stroke = "Transparent" x:Name = "FadeMask" StrokeThickness = "1" Opacity = "0" > < Ellipse.Fill > < SolidColorBrush Color = "AliceBlue" /> </ Ellipse.Fill > </ Ellipse > < Path Stroke = "White" StrokeThickness = "2" HorizontalAlignment = "Center" VerticalAlignment = "Center" x:Name = "arrow" SnapsToDevicePixels = "False" Data = "M1,1.5 L4.5,5 8,1.5" /> < Ellipse Height = "19" Width = "19" HorizontalAlignment = "Center" VerticalAlignment = "Center" x:Name = "Highlight" StrokeThickness = "2" Stroke = "Transparent" > < Ellipse.Fill > < DrawingBrush > < DrawingBrush.Drawing > < GeometryDrawing > < GeometryDrawing.Brush > < LinearGradientBrush Opacity = "0.6" StartPoint = "0,0" EndPoint = "0,1" > < GradientStop Color = "White" Offset = "0" /> < GradientStop Color = "#CCFFFFFF" Offset = "1" /> </ LinearGradientBrush > </ GeometryDrawing.Brush > < GeometryDrawing.Geometry > < EllipseGeometry Center = "0.5,0.5" RadiusX = "0.25" RadiusY = "0.5" /> </ GeometryDrawing.Geometry > </ GeometryDrawing > </ DrawingBrush.Drawing > < DrawingBrush.RelativeTransform > < ScaleTransform CenterX = "0.5" CenterY = "0" ScaleX = "1.05" ScaleY = "0.6" /> </ DrawingBrush.RelativeTransform > </ DrawingBrush > </ Ellipse.Fill > </ Ellipse > < ContentPresenter Margin = "4,0,0,0" HorizontalAlignment = "Left" x:Name = "ContentSite" VerticalAlignment = "Center" ContentTemplate = "{TemplateBinding ContentControl.ContentTemplate}" RecognizesAccessKey = "True" Content = "{TemplateBinding ContentControl.Content}" Grid.Column = "1" /> </ Grid > </ Border > < ControlTemplate.Triggers > < Trigger Property = "ToggleButton.IsChecked" Value = "True" > < Setter Property = "LayoutTransform" TargetName = "arrow" > < Setter.Value > < ScaleTransform ScaleY = "-1" /> </ Setter.Value > </ Setter > </ Trigger > < Trigger Property = "ToggleButton.IsPressed" Value = "True" > < Setter TargetName = "BackGrad" Property = "RenderTransform" > < Setter.Value > < TranslateTransform X = "0" Y = "1" /> </ Setter.Value > </ Setter > </ Trigger > < EventTrigger RoutedEvent = "UIElement.MouseEnter" > < EventTrigger.Actions > < BeginStoryboard > < Storyboard > < DoubleAnimation Storyboard.TargetName = "FadeMask" Storyboard.TargetProperty = "Opacity" To = "0.4" Duration = "0:0:0.25" /> </ Storyboard > </ BeginStoryboard > </ EventTrigger.Actions > </ EventTrigger > < EventTrigger RoutedEvent = "UIElement.MouseLeave" > < EventTrigger.Actions > < BeginStoryboard > < Storyboard > < DoubleAnimation Storyboard.TargetName = "FadeMask" Storyboard.TargetProperty = "Opacity" To = "0" Duration = "0:0:0.25" /> </ Storyboard > </ BeginStoryboard > </ EventTrigger.Actions > </ EventTrigger > </ ControlTemplate.Triggers > </ ControlTemplate > </ ToggleButton.Template > </ ToggleButton > < Border x:Name = "ExpandSite" Margin = "5,0,5,5" Background = "#77FFFFFF" BorderBrush = "{TemplateBinding Border.BorderBrush}" BorderThickness = "{TemplateBinding Border.BorderThickness}" > < Border.LayoutTransform > < ScaleTransform ScaleY = "0" /> </ Border.LayoutTransform > < ContentPresenter Margin = "{TemplateBinding Control.Padding}" HorizontalAlignment = "{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment = "{TemplateBinding Control.VerticalContentAlignment}" Focusable = "False" ContentTemplate = "{TemplateBinding ContentControl.ContentTemplate}" Content = "{TemplateBinding ContentControl.Content}" DockPanel.Dock = "Bottom" > </ ContentPresenter > </ Border > </ DockPanel > </ Border > </ Grid > < ControlTemplate.Triggers > < Trigger Property = "Expander.IsExpanded" Value = "True" > < Trigger.EnterActions > < BeginStoryboard > < Storyboard > < DoubleAnimation Storyboard.TargetName = "ExpandSite" Storyboard.TargetProperty = "LayoutTransform.ScaleY" To = "1" Duration = "0:0:0.5" /> < DoubleAnimation Storyboard.TargetName = "ExpandSite" Storyboard.TargetProperty = "Opacity" To = "1" Duration = "0:0:0.5" /> </ Storyboard > </ BeginStoryboard > </ Trigger.EnterActions > < Trigger.ExitActions > < BeginStoryboard > < Storyboard > < DoubleAnimation Storyboard.TargetName = "ExpandSite" Storyboard.TargetProperty = "LayoutTransform.ScaleY" To = "0" Duration = "0:0:0.5" /> < DoubleAnimation Storyboard.TargetName = "ExpandSite" Storyboard.TargetProperty = "Opacity" To = "0" Duration = "0:0:0.5" /> </ Storyboard > </ BeginStoryboard > </ Trigger.ExitActions > </ Trigger > </ ControlTemplate.Triggers > </ ControlTemplate > </ Setter.Value > </ Setter > </ Style > <!--统一的Expander样式--> <!--统一的按钮样式--> < ControlTemplate x:Key = "GlassButton" TargetType = "{x:Type Button}" > < ControlTemplate.Resources > < Storyboard x:Key = "Timeline1" > < DoubleAnimationUsingKeyFrames BeginTime = "00:00:00" Storyboard.TargetName = "Glow" Storyboard.TargetProperty = "(UIElement.Opacity)" > < SplineDoubleKeyFrame KeyTime = "00:00:00.1000000" Value = "1" /> </ DoubleAnimationUsingKeyFrames > </ Storyboard > < Storyboard x:Key = "Timeline2" > < DoubleAnimationUsingKeyFrames BeginTime = "00:00:00" Storyboard.TargetName = "Glow" Storyboard.TargetProperty = "(UIElement.Opacity)" > < SplineDoubleKeyFrame KeyTime = "00:00:00.1000000" Value = "0" /> </ DoubleAnimationUsingKeyFrames > </ Storyboard > </ ControlTemplate.Resources > < Border BorderBrush = "#FFCDCDCD" BorderThickness = "1,1,1,1" CornerRadius = "4,4,4,4" > < Border Background = "#B2000000" x:Name = "border" BorderBrush = "#CC000000" BorderThickness = "1,1,1,1" CornerRadius = "4,4,4,4" > < Grid > < Grid.RowDefinitions > < RowDefinition Height = "0.5*" /> < RowDefinition Height = "0.5*" /> </ Grid.RowDefinitions > < Border Opacity = "0" RenderTransformOrigin = "0.493,0.892" Margin = "0,0,0,0" x:Name = "Glow" Grid.RowSpan = "2" CornerRadius = "4,4,4,4" > < Border.Background > < RadialGradientBrush GradientOrigin = "0.5,0.567" > < RadialGradientBrush.RelativeTransform > < TransformGroup > < ScaleTransform CenterX = "0.5" CenterY = "0.5" ScaleX = "1.949" ScaleY = "2.092" /> < SkewTransform AngleX = "0" AngleY = "0" CenterX = "0.5" CenterY = "0.5" /> < RotateTransform Angle = "0" CenterX = "0.5" CenterY = "0.5" /> < TranslateTransform X = "0.022" Y = "0.308" /> </ TransformGroup > </ RadialGradientBrush.RelativeTransform > < GradientStop Color = "#B27CCCFF" Offset = "0" /> < GradientStop Color = "#335566FF" Offset = "1" /> </ RadialGradientBrush > </ Border.Background > </ Border > < ContentPresenter HorizontalAlignment = "Center" VerticalAlignment = "Center" Width = "Auto" Height = "Auto" Grid.RowSpan = "2" /> < Border HorizontalAlignment = "Stretch" Margin = "0,0,0,0" Width = "Auto" x:Name = "Shine" CornerRadius = "4,4,0,0" Grid.Row = "0" > < Border.Background > < LinearGradientBrush EndPoint = "0.547,-0.032" StartPoint = "0.547,0.73" > < GradientStop Color = "#33FFFFFF" Offset = "0" /> < GradientStop Color = "#99FFFFFF" Offset = "1" /> </ LinearGradientBrush > </ Border.Background > </ Border > </ Grid > </ Border > </ Border > < ControlTemplate.Triggers > < Trigger Property = "IsPressed" Value = "True" > < Setter Property = "Background" TargetName = "border" Value = "#66000000" /> < Setter Property = "Background" TargetName = "Shine" > < Setter.Value > < LinearGradientBrush EndPoint = "0.547,-0.032" StartPoint = "0.547,0.73" > < GradientStop Color = "#33FFFFFF" Offset = "0" /> < GradientStop Color = "#CCFFFFFF" Offset = "1" /> </ LinearGradientBrush > </ Setter.Value > </ Setter > < Setter Property = "Opacity" TargetName = "Glow" Value = "0.3" /> </ Trigger > < Trigger Property = "IsMouseOver" Value = "True" > < Trigger.EnterActions > < BeginStoryboard x:Name = "Timeline1_BeginStoryboard" Storyboard = "{StaticResource Timeline1}" /> </ Trigger.EnterActions > < Trigger.ExitActions > < BeginStoryboard x:Name = "Timeline2_BeginStoryboard" Storyboard = "{StaticResource Timeline2}" /> </ Trigger.ExitActions > </ Trigger > </ ControlTemplate.Triggers > </ ControlTemplate > < Style TargetType = "{x:Type Button}" > < Setter Property = "MinWidth" Value = "80" /> < Setter Property = "MinHeight" Value = "40" /> < Setter Property = "Foreground" Value = "#EEEEEEEE" /> < Setter Property = "Template" Value = "{DynamicResource GlassButton}" /> </ Style > <!--按钮样式结束--> </ Application.Resources > </ Application > |
好例子网口号:伸出你的我的手 — 分享!
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论