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

上海网站建设yes404屏蔽网页 的网站备案

上海网站建设yes404,屏蔽网页 的网站备案,滨州网站开发公司,wordpress怎么做论坛WPF中自动增加行#xff08;动画#xff09;的TextBox 原文:WPF中自动增加行#xff08;动画#xff09;的TextBoxWPF中自动增加行#xff08;动画#xff09;的TextBox WPF中的Textbox控件是可以自动换行的#xff0c;只要设置TextWrapping属性为”Wrap”即可#xff… WPF中自动增加行动画的TextBox 原文:WPF中自动增加行动画的TextBox WPF中自动增加行动画的TextBox WPF中的Textbox控件是可以自动换行的只要设置TextWrapping属性为”Wrap”即可但是存在一个问题Textbox的高度是固定的当输入文本过多时就会出现如下情况。 Textbox虽然没有自动增加高度的属性但是我们可以通过设置来实现这一个功能。相关xaml代码如下 Grid VerticalAlignmentTop HorizontalAlignmentLeft Width36 Height100TextBox x:NametextBox TextWrappingWrap VerticalAlignmentTop //Grid效果如下 这里需要注意的是 如果设置了textBox的Width、Height或者Margin属性那么此textBox的大小就已经限制死了不会自动增加会出现上图中的情况。如果想设置textBox的大小和位置需要把textBox放在一个Grid中通过Grid的属性来控制textBox上文中xaml文件中的方法其实到此为止所需要的功能已经实现了但是为了让让textbox更美观我加了一个动画 效果如下 表面上看是一个textbox其实是一个Grid加上2个textBox一个显示一个隐藏xaml代码如下 GridTextBox x:NametxtVisible TextWrappingWrap/TextBox x:NametxtHidden TextWrappingWrap VisibilityHidden VerticalAlignmentTop/ /GridGrid是用来控制textbox的大小的两个textbox中显示的那个用于输入文字隐藏的用于触发动画。原理如下 在txtVisible中输入文字的同时txtVisible把text传递给txtHidden当txtHidden中的内容已经满一行时会触发SizeChange事件这个事件再触发txtVisible高度变化动画。代码如下 public partial class txt : UserControl {private HeightAnimation anim;private double _animationDuration;public txt(){InitializeComponent();// Initialize the animationanim new HeightAnimation(this);AnimationDuration 500; //default value// Add the handlers to the required eventstxtHidden.SizeChanged TxtHidden_SizeChanged;txtVisible.TextChanged TxtVisible_TextChanged;}/// summary/// Gets or sets a value indicating whether the control is animated on loaded./// /summarypublic bool AnimateOnLoaded { get; set; } false;/// summary/// Gets or sets a value indicating whether the control is animated./// /summarypublic bool IsAnimated { get; set; } true;/// summary/// Gets or sets the duration of the animation./// /summarypublic double AnimationDuration{get { return _animationDuration; }set{_animationDuration value;anim.Duration new Duration(TimeSpan.FromMilliseconds(value));}}/// summary/// Gets or sets the text contents of the AnimatedTextBox./// /summarypublic string Text{get { return txtHidden.Text; }set{txtHidden.Text value;txtVisible.Text value;}}private void TxtVisible_TextChanged(object sender, TextChangedEventArgs e){// When the users writing in txtVisible, we copy the text to txtHiddentxtHidden.Text txtVisible.Text;}private void TxtHidden_SizeChanged(object sender, SizeChangedEventArgs e){OnHeightChanged(e.PreviousSize.Height, e.NewSize.Height);}/// summary/// To execute when the txtHiddens Height has changed./// /summaryprivate void OnHeightChanged(double previousHeight, double newHeight){//Animation type, increase txtVisibles height or decreaseanim.ChangeType (newHeight previousHeight) ? HeightAnimation.ChangeTypes.Increased : HeightAnimation.ChangeTypes.Decreased;// Animate the Height from the txtHiddens previousHeight to its newHeightanim.From previousHeight;anim.To newHeight;// Start the animationanim.BeginAnimation();}/// summary/// Manages the AnimatedTextBox Heights animation./// /summaryprivate class HeightAnimation{private Storyboard sb;private DoubleAnimation anim;private double _from;private double _to;private Duration _duration;private FrameworkElement _fe;private ChangeTypes _changeType;/// summary/// The possible types of the Height change./// /summarypublic enum ChangeTypes{Increased,Decreased}/// summary/// Constructor of the class./// /summarypublic HeightAnimation(FrameworkElement fe){// Set the FrameworkElement which manages the animation_fe fe;// Initialize the Storyboardsb new Storyboard();sb.AutoReverse false;// Initialize the animationanim new DoubleAnimation();anim.Name anim;// Set the EasingFunction on a new instance of CubicEase whose EasingMode is EaseInOutanim.EasingFunction new CubicEase() { EasingMode EasingMode.EaseInOut };// Bind the Animation with the txtVisible TextBoxStoryboard.SetTargetName(anim, txtVisible);// Add the animation to the Storyboards childrensb.Children.Add(anim);}/// summary/// Gets or sets the type of the Height change./// /summarypublic ChangeTypes ChangeType{get { return _changeType; }set{_changeType value;/* If the Height has inreased, set the target property to MaxHeight, else to MinHeight* (instead of animating directly the Height, we animate MaxHeight/MinHeight to prevent the AnimatedTextBox* from growing/shrinking suddenly) */Storyboard.SetTargetProperty(anim, new PropertyPath(string.Format((TextBox.{0}), (value ChangeTypes.Increased) ? MaxHeight : MinHeight)));}}/// summary/// Gets or sets the animations starting Height./// /summarypublic double From{get { return _from; }set{_from value;anim.From value;}}/// summary/// Gets or sets the animations ending Height./// /summarypublic double To{get { return _to; }set{_to value;anim.To value;}}/// summary/// Gets or sets the animations duration./// /summarypublic Duration Duration{get { return _duration; }set{_duration value;anim.Duration value;}}/// summary/// Begins the animation./// /summarypublic void BeginAnimation(){_fe.BeginStoryboard(sb);}} }posted on 2019-01-15 17:08 NET未来之路 阅读(...) 评论(...) 编辑 收藏 转载于:https://www.cnblogs.com/lonelyxmas/p/10272989.html
http://www.sadfv.cn/news/361019/

相关文章:

  • 企业网站管理系统项目文档响应式网站模仿
  • 触屏网站开发手机版网页开发者工具
  • 毕业设计模板网站php apc缓存 wordpress
  • 合肥做微网站抖音代运营公司经营范围
  • 网站的优化用什么软件下载上海英文网站建设公司
  • 红色企业网站模板深圳app开发公司前十名
  • 校园网网站建设规划书wordpress qiniu-uploader 使用
  • 专门做淘宝优惠券的网站怎样建设淘宝客导购网站
  • 网站建设运营合同阿里云轻量级wordpress
  • 网站服务器查询装修全包
  • 没学过计算机开始学做网站数据网站建设
  • 福建省分行建设银行网站广告设计图片简单
  • 做企业网站比较好的公司陕西建设厅官网系统平台
  • 沈阳模板建站代理制作网站代码吗
  • 车都建设投资集团网站美工个人网站
  • 晋中市两学一做网站深圳品牌策划公司推荐
  • 龙岗网站制作讯息宁波新亚建设内部网站
  • 建设网站如何赢利建设二手商品网站总结
  • 企业网站建设方案有那些仿站建设
  • 做100个网站效果做一个网站需要多少时间
  • 设计电子商务网站自己做优惠劵网站赚钱吗
  • 学做网站能找到工作么成都计算机编程培训哪里好
  • 怀化公司做网站wordpress最大图片尺寸
  • wordpress 安全性设置短视频关键词seo优化
  • asp.net网站sql权限设置Wordpress自己定义主页界面
  • 建站平台免代码建设论坛网站视频
  • 同ip网站怎么做南京做网站企业
  • 网站自助搭建展示产品的网站 个人备案还是企业
  • 闽清县城乡建设局网站台州网站建设平台
  • 网站有标题北京微网站建设