当前位置: 首页 > news >正文

品牌网站建设哪好设计师网页设计

品牌网站建设哪好,设计师网页设计,美容培训东莞网站建设,十大网站开发公司WPF开发者QQ群此群已满340500857 #xff0c;请加新群458041663由于微信群人数太多入群请添加小编微信号yanjinhuawechat 或 W_Feng_aiQ 邀请入群需备注WPF开发者 01—代码如下一、创建AnimationAudio.xaml代码如下。ResourceDictionary xmlnshttp://schemas.micros… WPF开发者QQ群此群已满340500857 请加新群458041663       由于微信群人数太多入群请添加小编微信号 yanjinhuawechat 或 W_Feng_aiQ 邀请入群 需备注WPF开发者 01—代码如下一、创建AnimationAudio.xaml代码如下。ResourceDictionary xmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:controlsclr-namespace:WPFDevelopers.Controlsxmlns:helpersclr-namespace:WPFDevelopers.HelpersResourceDictionary.MergedDictionariesResourceDictionary SourceBasic/ControlBasic.xaml/ResourceDictionary SourceBasic/Animations.xaml//ResourceDictionary.MergedDictionariesStyle TargetType{x:Type controls:AnimationAudio} BasedOn{StaticResource ControlBasicStyle}Setter PropertyWidth Value80/Setter PropertyHeight Value35/Setter PropertyCursor ValueHand/Setter PropertyForeground Value{DynamicResource WhiteSolidColorBrush}/Setter PropertyBackground Value{DynamicResource PrimaryNormalSolidColorBrush}/Setter PropertyTemplateSetter.ValueControlTemplate TargetType{x:Type controls:AnimationAudio}ControlTemplate.ResourcesStoryboard x:KeyPlayStoryboard RepeatBehaviorForeverObjectAnimationUsingKeyFrames Storyboard.TargetNamePathAudioTwo Storyboard.TargetProperty(Path.Visibility)DiscreteObjectKeyFrame KeyTime0:0:0 Value{x:Static Visibility.Hidden} //ObjectAnimationUsingKeyFramesObjectAnimationUsingKeyFrames Storyboard.TargetNamePathAudioThree Storyboard.TargetProperty(Path.Visibility)DiscreteObjectKeyFrame KeyTime0:0:0 Value{x:Static Visibility.Hidden} //ObjectAnimationUsingKeyFramesObjectAnimationUsingKeyFrames BeginTime0:0:.3 Duration0:0:.4 Storyboard.TargetNamePathAudioTwoStoryboard.TargetProperty(Path.Visibility)DiscreteObjectKeyFrame KeyTime0:0:0 Value{x:Static Visibility.Visible} //ObjectAnimationUsingKeyFramesObjectAnimationUsingKeyFrames BeginTime0:0:.7 Duration0:0:.4 Storyboard.TargetNamePathAudioThreeStoryboard.TargetProperty(Path.Visibility)DiscreteObjectKeyFrame KeyTime0:0:0 Value{x:Static Visibility.Visible} //ObjectAnimationUsingKeyFrames/Storyboard/ControlTemplate.ResourcesBorder x:NamePART_Border Background{TemplateBinding Background} CornerRadius{TemplateBinding helpers:ControlsHelper.CornerRadius}SnapsToDevicePixelsTrue UseLayoutRoundingTrueGridGrid.ColumnDefinitionsColumnDefinition/ColumnDefinition//Grid.ColumnDefinitionsStackPanel Width20 Height30 HorizontalAlignmentLeft OrientationHorizontal Margin10,0RenderTransformOrigin.5,.5x:NamePART_StackPanelPath Data{StaticResource PathAudioOne} Width4 Height6 StretchFill Fill{TemplateBinding Foreground}/Path x:NamePathAudioTwo Data{StaticResource PathAudioTwo} Width6 StrokeThickness1.5 StrokeTransparent Margin0,7 StretchFill Fill{TemplateBinding Foreground}/Path x:NamePathAudioThree Data{StaticResource PathAudioThree} Width8 Margin-3,4 StretchFill Fill{TemplateBinding Foreground} StrokeThickness2 StrokeTransparent//StackPanelTextBlock VerticalAlignmentCenter Foreground{TemplateBinding Foreground}FontSize{DynamicResource TitleFontSize}Grid.Column1x:NamePART_TextBlockRun x:NamePART_RunTimeLength/Run/TextBlock/Grid/BorderControlTemplate.TriggersTrigger PropertyIsPlay ValueTrueTrigger.EnterActionsBeginStoryboard x:NamePlayBeginStoryboard Storyboard{StaticResource PlayStoryboard}//Trigger.EnterActionsTrigger.ExitActionsStopStoryboard BeginStoryboardNamePlayBeginStoryboard//Trigger.ExitActions/TriggerTrigger PropertyIsRight ValueTrueSetter PropertyGrid.Column TargetNamePART_TextBlock Value0/Setter PropertyHorizontalAlignment TargetNamePART_TextBlock ValueRight/Setter PropertyGrid.Column TargetNamePART_StackPanel Value1/Setter PropertyHorizontalAlignment TargetNamePART_StackPanel ValueRight/Setter PropertyRenderTransform TargetNamePART_StackPanelSetter.ValueTransformGroupRotateTransform Angle180//TransformGroup/Setter.Value/Setter/Trigger/ControlTemplate.Triggers/ControlTemplate/Setter.Value/Setter/Style/ResourceDictionary二、创建AnimationAudioe.cs代码如下。using System; using System.IO; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Interop; using WPFDevelopers.Helpers;namespace WPFDevelopers.Controls {[TemplatePart(Name  RunTemplateName, Type  typeof(Run))]public partial class AnimationAudio : Control{const string RunTemplateName  PART_RunTimeLength;private Run _run;private TimeSpan _timeSpan;private IntPtr _handle;private AudioWindow _win  null;static string[] mediaExtensions  { .MP3, .WAV };/// summary/// 音频路径/// /summarypublic string AudioPath{get { return (string)GetValue(AudioPathProperty); }set { SetValue(AudioPathProperty, value); }}public static readonly DependencyProperty AudioPathProperty DependencyProperty.Register(AudioPath, typeof(string), typeof(AnimationAudio), new PropertyMetadata(string.Empty));/// summary/// 是否右侧/// /summarypublic bool IsRight{get { return (bool)GetValue(IsRightProperty); }set { SetValue(IsRightProperty, value); }}public static readonly DependencyProperty IsRightProperty DependencyProperty.Register(IsRight, typeof(bool), typeof(AnimationAudio), new PropertyMetadata(false));public bool IsPlay{get { return (bool)GetValue(IsPlayProperty); }set { SetValue(IsPlayProperty, value); }}public static readonly DependencyProperty IsPlayProperty DependencyProperty.Register(IsPlay, typeof(bool), typeof(AnimationAudio), new PropertyMetadata(false, new PropertyChangedCallback(OnIsPlayChanged)));private static void OnIsPlayChanged(DependencyObject d, DependencyPropertyChangedEventArgs e){bool newValue  (bool)e.NewValue;var animationAudio  d as AnimationAudio;if(newValue ! (bool)e.OldValue){if (newValue){animationAudio.Play();}else{AudioPlayer.Stop();}}}static AnimationAudio(){DefaultStyleKeyProperty.OverrideMetadata(typeof(AnimationAudio), new FrameworkPropertyMetadata(typeof(AnimationAudio)));}public override void OnApplyTemplate(){base.OnApplyTemplate();_run  GetTemplateChild(RunTemplateName) as Run;if (string.IsNullOrWhiteSpace(AudioPath)) return;if (!File.Exists(AudioPath)) return;if (!mediaExtensions.Contains(Path.GetExtension(AudioPath), StringComparer.OrdinalIgnoreCase)) return;_timeSpan  AudioPlayer.GetSoundLength(AudioPath);if (_timeSpan  TimeSpan.Zero) return;_run.Text  ${_timeSpan.Seconds.ToString()}\;Width  80;if (_timeSpan.Seconds  5){Width  _timeSpan.Seconds;}}private void Play(){if(_win ! null){_win.Close();_win  null;}_win  new AudioWindow{Width  0,Height  0,Left  Int32.MinValue,Top  Int32.MinValue,WindowStyle  WindowStyle.None,ShowInTaskbar  false,ShowActivated  false,};_win.Show();_win.StopDelegateEvent  _win_StopDelegateEvent;_handle  new WindowInteropHelper(_win).Handle;AudioPlayer.PlaySong(AudioPath, _handle);}private void _win_StopDelegateEvent(){IsPlay  false;_win.Close();_win  null;}} }三、新建AudioWindow.cs代码如下。using System; using System.Windows; using System.Windows.Interop;namespace WPFDevelopers.Controls {public class AudioWindow:Window{const int MM_MCINOTIFY  0x3B9;public delegate void StopDelegate();public event StopDelegate StopDelegateEvent;protected override void OnSourceInitialized(EventArgs e){base.OnSourceInitialized(e);HwndSource hwndSource  PresentationSource.FromVisual(this) as HwndSource;if (hwndSource ! null){hwndSource.AddHook(new HwndSourceHook(this.WndProc));}}IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled){switch (msg){case MM_MCINOTIFY:StopDelegateEvent?.Invoke();break;}return IntPtr.Zero;}} }四、新建AnimationAudioExample.xaml代码如下。UserControl x:ClassWPFDevelopers.Samples.ExampleViews.AnimationAudioExamplexmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:dhttp://schemas.microsoft.com/expression/blend/2008 xmlns:localclr-namespace:WPFDevelopers.Samples.ExampleViewsxmlns:wpfdevhttps://github.com/WPFDevelopersOrg/WPFDevelopersmc:Ignorabled d:DesignHeight450 d:DesignWidth800UniformGrid Columns2 x:NameMyUniformGridStackPanel OrientationHorizontalwpfdev:BreathLamp Width60 Height60 LampEffectRippleIsLampStarttrueMargin10,0Ellipse Width50 Height50Ellipse.FillImageBrush ImageSourcepack://application:,,,/WPFDevelopers.Samples;component/Images/Breathe/0.jpg//Ellipse.Fill/Ellipse/wpfdev:BreathLampwpfdev:AnimationAudio x:NameAnimationAudioLeft MouseDownAnimationAudioLeft_MouseDown//StackPanelStackPanel OrientationHorizontalHorizontalAlignmentRightwpfdev:AnimationAudio x:NameAnimationAudioRight IsRight true Background{DynamicResource SuccessSolidColorBrush}ForegroundBlackMouseDownAnimationAudioLeft_MouseDown/wpfdev:BreathLamp Width50 Height50 LampEffectStreamerBackgroundLightGrayIsLampStartTrueMargin10,0Ellipse Width43 Height43Ellipse.FillImageBrush ImageSourcepack://application:,,,/WPFDevelopers.Samples;component/Images/Chat/UserImages/yanjinhua.png//Ellipse.Fill/Ellipse/wpfdev:BreathLamp/StackPanel/UniformGrid /UserControl六、新建AnimationAudioExample.xaml.cs下。using System; using System.IO; using System.Windows.Controls; using WPFDevelopers.Controls; using WPFDevelopers.Samples.Helpers;namespace WPFDevelopers.Samples.ExampleViews {/// summary/// 微信公众号:WPF开发者/// /summarypublic partial class AnimationAudioExample : UserControl{public AnimationAudioExample(){InitializeComponent();AnimationAudioLeft.AudioPath  Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Resources, Audio, HelloWPFDevelopes_en.mp3);AnimationAudioRight.AudioPath  Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Resources, Audio, HelloWPFDevelopes_zh.mp3);}private void AnimationAudioLeft_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e){var animationAudio  sender as AnimationAudio;var animationAudioList  ElementVisualTreeHelper.FindVisualChildAnimationAudio(MyUniformGrid);if (animationAudioList  null) return;if (!animationAudio.IsPlay){animationAudioList.ForEach(h {if (h.IsPlay  h ! animationAudio){h.IsPlay  false;}});animationAudio.IsPlay  true;}elseanimationAudio.IsPlay  false;}} }02—效果预览鸣谢素材提供者 - 吴锋源码地址如下Githubhttps://github.com/WPFDevelopersOrgGiteehttps://gitee.com/WPFDevelopersOrgWPF开发者QQ群 340500857 | 458041663Githubhttps://github.com/WPFDevelopersOrg出处https://www.cnblogs.com/yanjinhua版权本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。转载请著名作者 出处 https://github.com/WPFDevelopersOrg扫一扫关注我们更多知识早知道点击阅读原文可跳转至源代码
http://www.yutouwan.com/news/273669/

相关文章:

  • 建设公司网站需要多少钱1sose wordpress
  • 山东省住房城乡建设厅网站那个网站做h5不要钱
  • 做网站怎么对接国际收款商户网站上如何做电子手册
  • 国外建筑设计网站推荐外贸人常用的网站
  • 专业网站搭建运营网站开发什么语言
  • asp.net网站开发简介开发小程序用什么软件写代码
  • 12306铁路网站开发语言合肥网页设计工资一般多少
  • 免费个人微网站模板网页前端是什么工作
  • 最新网站开发价格建网站怎么分类
  • 网站建设1000字做老师好还是网站编辑好
  • 贵阳网站建设 网站制作百度域名注册官网
  • 做啊网站太原建设设计公司网站
  • 德州做网站建设的公司哪家好哪些网站可以做翻译兼职
  • 公司注销后 网站备案吗网络管理系统功能
  • 网站建设价表模板湖南百度推广代理商
  • 摄影网站设计方案网站建设需准备什么
  • 印江建设局网站西宁企业做网站
  • 做网站网站制作签名在线生成器
  • 织梦网站首页模板路径设计方案万能模板
  • 网站建设与运营推广的回报材料最好的装饰公司营销型网站
  • 做网站 英语四川建网站
  • 百度教育网站服装logo设计
  • 中国会议营销网站做视频网站怎么看不会卡
  • 深圳福田网站制作公司wordpress 微博登录注册
  • 域名注册平台的网站怎么做实时开奖走势网站建设
  • 网站设计定制多少钱wordpress音乐播放插件
  • 网站样式用什么做的wordpress目录下
  • 静态网站建设的主要技术网络营销方法的典型案例
  • 手机网站登陆模板产品设计考研学校排名
  • 做网站推广的联系方式大型网站如何做别名