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

电商网站规划的开发背景网站建设维护去哪里学

电商网站规划的开发背景,网站建设维护去哪里学,域名访问网站是什么意思,贵州省省建设厅网站WPF开发者QQ群此群已满340500857 #xff0c;请加新群458041663由于微信群人数太多入群请添加小编微信号yanjinhuawechat 或 W_Feng_aiQ 邀请入群需备注WPF开发者 01—代码如下一、创建CheckCode.xaml代码如下。ResourceDictionary xmlnshttp://schemas.microsoft.c… WPF开发者QQ群此群已满340500857 请加新群458041663       由于微信群人数太多入群请添加小编微信号 yanjinhuawechat 或 W_Feng_aiQ 邀请入群 需备注WPF开发者 01—代码如下一、创建CheckCode.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.MergedDictionariesStyle TargetType{x:Type controls:CheckCode} BasedOn{StaticResource ControlBasicStyle}Setter PropertyBackground Value{x:Null}/Setter PropertyWidth Value100/Setter PropertyHeight Value40/Setter PropertyCursor ValueHand/Setter PropertyTemplateSetter.ValueControlTemplate TargetType{x:Type controls:CheckCode}Image x:NamePART_Image StretchFill Source{TemplateBinding ImageSource}//ControlTemplate/Setter.Value/Setter/Style /ResourceDictionary二、CheckCode.cs代码如下。using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging;namespace WPFDevelopers.Controls {[TemplatePart(Name  ImageTemplateName, Type  typeof(Image))]public class CheckCode : Control{private const string ImageTemplateName  PART_Image;private Image _image;private Size _size  new Size(70, 23);private const string strCode  abcdefhkmnprstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789; public static readonly DependencyProperty ImageSourceProperty  DependencyProperty.Register(ImageSource, typeof(ImageSource), typeof(CheckCode),new PropertyMetadata(null));/// summary/// 随机生成的验证码/// /summarypublic ImageSource ImageSource{get { return (ImageSource)GetValue(ImageSourceProperty); }set { SetValue(ImageSourceProperty, value); }}/// summary/// 字体颜色/// /summarypublic Brush SizeColor{get { return (Brush)GetValue(SizeColorProperty); }set { SetValue(SizeColorProperty, value); }}public static readonly DependencyProperty SizeColorProperty DependencyProperty.Register(SizeColor, typeof(Brush), typeof(CheckCode), new PropertyMetadata(DrawingContextHelper.Brush));public CheckCode(){this.Loaded  CheckCode_Loaded;}private void CheckCode_Loaded(object sender, RoutedEventArgs e){ImageSource  CreateCheckCodeImage(CreateCode(4), (int)this.ActualWidth, (int)this.ActualHeight);}public override void OnApplyTemplate(){base.OnApplyTemplate();_image  GetTemplateChild(ImageTemplateName) as Image;if (_image ! null)_image.PreviewMouseDown  _image_PreviewMouseDown;}private void _image_PreviewMouseDown(object sender, MouseButtonEventArgs e){if (!IsLoaded)return;ImageSource  CreateCheckCodeImage(CreateCode(4), (int)this.ActualWidth, (int)this.ActualHeight);}private string CreateCode(int strLength){var _charArray  strCode.ToCharArray();var randomCode  ;int temp  -1;Random rand  new Random(Guid.NewGuid().GetHashCode());for (int i  0; i  strLength; i){if (temp ! -1)rand  new Random(i * temp * ((int)DateTime.Now.Ticks));int t  rand.Next(strCode.Length - 1);if (!string.IsNullOrWhiteSpace(randomCode)){while (randomCode.ToLower().Contains(_charArray[t].ToString().ToLower()))t  rand.Next(strCode.Length - 1);}if (temp  t)return CreateCode(strLength);temp  t;randomCode  _charArray[t];}return randomCode;}private ImageSource CreateCheckCodeImage(string checkCode, int width, int height){if (string.IsNullOrWhiteSpace(checkCode))return null;if (width  0 || height  0)return null;var drawingVisual  new DrawingVisual();var random  new Random(Guid.NewGuid().GetHashCode());using (DrawingContext dc  drawingVisual.RenderOpen()){dc.DrawRectangle(Brushes.White, new Pen(SizeColor, 1), new Rect(_size));var formattedText  DrawingContextHelper.GetFormattedText(checkCode,color:SizeColor, flowDirection: FlowDirection.LeftToRight,textSize:20, fontWeight: FontWeights.Bold);dc.DrawText(formattedText, new Point((_size.Width - formattedText.Width) / 2, (_size.Height - formattedText.Height) / 2));for (int i  0; i  10; i){int x1  random.Next(width - 1);int y1  random.Next(height - 1);int x2  random.Next(width - 1);int y2  random.Next(height - 1);dc.DrawGeometry(Brushes.Silver, new Pen(Brushes.Silver, 0.5D), new LineGeometry(new Point(x1, y1), new Point(x2, y2)));}for (int i  0; i  100; i){int x  random.Next(width - 1);int y  random.Next(height - 1);SolidColorBrush c  new SolidColorBrush(Color.FromRgb((byte)random.Next(0, 255), (byte)random.Next(0, 255), (byte)random.Next(0, 255)));dc.DrawGeometry(c, new Pen(c, 1D), new LineGeometry(new Point(x - 0.5, y - 0.5), new Point(x  0.5, y  0.5)));}dc.Close();}var renderBitmap  new RenderTargetBitmap(70, 23, 96, 96, PixelFormats.Pbgra32);renderBitmap.Render(drawingVisual);return BitmapFrame.Create(renderBitmap);}} }三、新建CheckCodeExample.cs代码如下。UserControl x:ClassWPFDevelopers.Samples.ExampleViews.CheckCodeExamplexmlnshttp://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 Rows2 Columns2wpfdev:CheckCode SizeColorLimeGreen/wpfdev:CheckCode SizeColorRed/wpfdev:CheckCode SizeColorDodgerBlue/wpfdev:CheckCode SizeColorHotPink//UniformGrid /UserControl02—效果预览鸣谢素材提供者 - 屈越源码地址如下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.pierceye.com/news/12927/

相关文章:

  • 网站如何做二级域名东莞市有几个区
  • 网站的内链建设wordpress 播放视频
  • 微网站开发提供的服务器可以做网站的路由器
  • php电子商务网站模板全国网站开发公司
  • 建站网站主题设置不能点学校网站开发需求
  • 网站设计 品牌设计做下载网站赚钱吗
  • 怎么知道网站有没有备案推荐微网站建设
  • 贵州建设监理协会网站网站筛选功能
  • 网站开发常用语言总结黑龙江网站建设巨耀网络
  • 网站改版怎么弄做有网被视频网站有哪些
  • 商城网站建设教学央企网站开发
  • 高职图书馆网站建设大赛拼多多货源一件代发平台
  • 网站数据修改WordPress立体边框
  • 怎么做网站版面网站建设产品经理职责
  • html5做网站链接范例在线生成个人网站免费观看
  • 做网站如何对接支付科技小制作怎么做视频网站
  • 福州++网站建设自己怎么制作网页链接
  • 用html做网站顺序wordpress上传的图片不显示
  • 屋领网站固链广告平面设计师
  • 陕西省建设教育培训中心网站网站建设投资
  • 定制网站哪个好无锡市网站设计
  • 做网站需要备案吗百度关键词搜索排名帝搜软件
  • 赶集网天津网站建设wordpress 弹窗登录插件
  • 多语言做网站浅谈网站建设
  • 丽水微信网站建设价格wordpress禁止某ip
  • 为什么没有人做搜索网站了阿里企业网站建设
  • 建设教育局网站硬件价格需要多少钱全国企业信息查询系统入口官网
  • 小网站开发框架照片图片制作
  • 网站营销与推广方案如何注册国外域名
  • 如何做汽车的创意视频网站设计房产中介网站建设进度