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

内蒙古住房与城乡建设厅网站网址全面的移动网站建设

内蒙古住房与城乡建设厅网站网址,全面的移动网站建设,北京专业网站制作介绍,工程建设监理名词解释WPF开发者QQ群#xff1a; 340500857由于微信群人数太多入群请添加小编微信号yanjinhuawechat 或 W_Feng_aiQ 邀请入群需备注WPF开发者 PS#xff1a;有更好的方式欢迎推荐。接着上一篇倒计时控件01—代码如下一、创建 CropControl.cs代码如下。#xff08;修改RowColumn “… WPF开发者QQ群 340500857       由于微信群人数太多入群请添加小编微信号 yanjinhuawechat 或 W_Feng_aiQ 邀请入群 需备注WPF开发者   PS有更好的方式欢迎推荐。  接着上一篇倒计时控件01—代码如下一、创建 CropControl.cs代码如下。修改RowColumn “6” 或者“12”  甚至其他 都能拆分原图为多张小图using System; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Shapes;namespace WPFDevelopers.Controls {[TemplatePart(Name  UniformGridTemplateName, Type  typeof(UniformGrid))]public class CropControl: Control{private const string UniformGridTemplateName  PART_UniformGrid;private UniformGrid _uniformGrid;public ImageSource ImageSource{get { return (ImageSource)GetValue(ImageSourceProperty); }set { SetValue(ImageSourceProperty, value); }}public static readonly DependencyProperty ImageSourceProperty DependencyProperty.Register(ImageSource, typeof(ImageSource), typeof(CropControl), new PropertyMetadata(null));public int RowColumn{get { return (int)GetValue(RowColumnProperty); }set { SetValue(RowColumnProperty, value); }}public static readonly DependencyProperty RowColumnProperty DependencyProperty.Register(RowColumn, typeof(int), typeof(CropControl), new PropertyMetadata(3));static CropControl(){DefaultStyleKeyProperty.OverrideMetadata(typeof(CropControl), new FrameworkPropertyMetadata(typeof(CropControl)));}public override void OnApplyTemplate(){base.OnApplyTemplate();_uniformGrid  GetTemplateChild(UniformGridTemplateName) as UniformGrid;if (ImageSource  null || _uniformGrid  null) return;BitmapSource imgSource  (BitmapSource)ImageSource;int w  0, h  0;if (!imgSource.PixelWidth.Equals(0)!imgSource.PixelHeight.Equals(0)){w  imgSource.PixelWidth / RowColumn;h  (int)imgSource.PixelHeight / RowColumn;_uniformGrid.Width  imgSource.PixelWidth;_uniformGrid.Height  imgSource.PixelHeight;}for (int i  0; i  RowColumn; i){for (int j  0; j  RowColumn; j){var rect  new Rectangle{Fill  new ImageBrush { ImageSource  new CroppedBitmap(imgSource, new Int32Rect(j * w, i * h, w, h)) },StrokeThickness  .5,Stroke  Brushes.White,Cursor  Cursors.Hand};rect.RenderTransformOrigin  new Point(.5, .5);rect.RenderTransform  new ScaleTransform();rect.MouseMove  (sender, ex) {var rect1  sender as Rectangle;Panel.SetZIndex(rect1, 1);var doubleAnimation  new DoubleAnimation{To  2,Duration  TimeSpan.FromMilliseconds(100),};var scaleTransform  rect1.RenderTransform as ScaleTransform;scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, doubleAnimation);scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, doubleAnimation);};rect.MouseLeave  (sender, ex) {var rect1  sender as Rectangle;Panel.SetZIndex(rect1, 0);var scaleTransform  rect1.RenderTransform as ScaleTransform;var doubleAnimation  new DoubleAnimation{To  1,Duration  TimeSpan.FromMilliseconds(100)};scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, doubleAnimation);scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, doubleAnimation);};_uniformGrid.Children.Add(rect);}}}} }二、CropControl.xaml 代码如下ResourceDictionary xmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:controlsclr-namespace:WPFDevelopers.ControlsResourceDictionary.MergedDictionariesResourceDictionary SourceBasic/ControlBasic.xaml/ResourceDictionary SourceBasic/Animations.xaml//ResourceDictionary.MergedDictionariesStyle TargetType{x:Type controls:CropControl} BasedOn{StaticResource ControlBasicStyle}Setter PropertyTemplateSetter.ValueControlTemplate TargetType{x:Type controls:CropControl}UniformGrid Rows{TemplateBinding RowColumn} Columns{TemplateBinding RowColumn}x:NamePART_UniformGrid//ControlTemplate/Setter.Value/Setter/Style/ResourceDictionary三、CropControlExample.xaml 代码如下UserControl x:ClassWPFDevelopers.Samples.ExampleViews.CropControlExamplexmlnshttp://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/yanjinhuagood/WPFDevelopersmc:Ignorabled d:DesignHeight450 d:DesignWidth800Gridwpfdev:CropControl ImageSourcepack://application:,,,/WPFDevelopers.Samples;component/Images/Crop/0.jpg//Grid /UserControl02—效果预览鸣谢素材提供者 - 关关(代强)源码地址如下Githubhttps://github.com/WPFDevelopersOrgGiteehttps://gitee.com/WPFDevelopersOrgWPF开发者QQ群 340500857 Githubhttps://github.com/WPFDevelopersOrg出处https://www.cnblogs.com/yanjinhua版权本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。转载请著名作者 出处 https://github.com/WPFDevelopersOrg扫一扫关注我们更多知识早知道点击阅读原文可跳转至源代码
http://www.yutouwan.com/news/343699/

相关文章:

  • 承接网站网站建设网站建设图片编辑
  • wordpress网站价钱wordpress页面评论
  • Wordpress网站仿站wordpress化学式编辑插件
  • 如何让百度收录自己的网站信息wordpress永久链接无效
  • 品牌推广公司简介东莞有限公司seo
  • 微信小程序可以做音乐网站吗云南网站设计选哪家
  • dede网站备份合适的网站制作需要多少钱
  • 手机金融界网站永嘉网站建设几
  • 网站二级页面需不需要设置关键词网站取源用iapp做软件
  • 广州网站推广电话新都网站开发
  • 网站免费正能量直接进入浏览器下载安装做色流网站要注意什么问题
  • 国内好点的wordpress主题百度关键词优化有效果吗
  • 郑州制作网站做网站比较好
  • 公司网站建设哪家公司好有哪些可以做h5的网站
  • 工程设计与建设 网站c网站开发教程
  • 如何设计响应式布局网站建筑工程公司管理制度
  • 网站空间哪家公司的好wordpress静态页生成
  • 长春做网站哪家公司好湖南建设教育网
  • 胶州网站建设 网络推广常州网站建设公司案例
  • 网站建设费 无形资产关于网站制作的论文
  • 深圳英文网站开发wordpress接入微信
  • php做网站的支付功能怎么做推广网站赌场
  • 彩票网站开发亿云简单详细搭建网站教程视频
  • 自己做的网站打开空白电子商务网站营销的方法
  • 建自己的网站做外贸江西建筑培训网
  • 机械公司网站模板杭州软件网站建设
  • 胶州城乡建设局网站怎样做好网站用户体验
  • 怎么做动漫小广告视频网站微信小程序上线流程
  • 手机影视素材网站大全网络营销网站建设案例
  • 济南外贸网站有没有做电子名片的网站