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

建站软件有哪些功能南通网络科技的公司网站

建站软件有哪些功能,南通网络科技的公司网站,wordpress连接oss,中学生制作网站【 声明#xff1a;版权所有#xff0c;欢迎转载#xff0c;请勿用于商业用途。 联系信箱#xff1a;feixiaoxing 163.com】 前面我们写过一个绘图软件#xff0c;不过那个比较简单#xff0c;主要就是用鼠标模拟pen进行绘图。实际应用中#xff0c;另外一种使用比较多的…【 声明版权所有欢迎转载请勿用于商业用途。 联系信箱feixiaoxing 163.com】 前面我们写过一个绘图软件不过那个比较简单主要就是用鼠标模拟pen进行绘图。实际应用中另外一种使用比较多的场景就是绘制直线、长方形和圆形。不管是流程图还是传感器仿真或者是图形数据动态显示等等绘图部分本身还是有着重要的实际用途。因此这里有必要告诉大家实际的canvas绘图是什么样的。 这里的增强版主要也是指的直线绘图、长方形绘图和圆形绘图。当然如果要做得好的话一般还需要同步考虑一下keyboard事件这部分也很重要。 1、软件设计 关于软件设计目前是这么考虑的。可以创建一个菜单里面有三个子菜单这三个子菜单分别是直线、长方形和圆形。我们选择了一种图形那么其他的图形就自动被放弃。后续在canvas上面绘图的时候就用对应子菜单的形式进行绘图即可。 2、界面设计 相对代码界面设计还是比较简单的。整个界面主要就两个部分一部分是菜单一部分是canvas。做好了这个基本的界面就准备好了。 Window x:ClassWpfApp.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:localclr-namespace:WpfAppmc:IgnorabledTitleCanvas Height450 Width600GridMenu NameshapesMenuMenuItem HeaderShapesMenuItem NamemenuItemLine HeaderLine IsCheckableTrue IsCheckedfalse CheckedMenuItemLine_Checked/MenuItem NamemenuItemRectangle HeaderRectangle IsCheckableTrue IsCheckedFalse CheckedMenuItemRectangle_Checked/MenuItem NamemenuItemCircle HeaderCircle IsCheckableTrue IsCheckedFalse CheckedMenuItemCircle_Checked//MenuItem/MenuCanvas NamedrawingCanvas BackgroundWhiteSmoke MouseDownCanvas_MouseDown MouseMoveCanvas_MouseMove MouseUpCanvas_MouseUp Margin0,20,0,10//Grid /Window3、代码设计 由于是绘图所以整个绘图的操作其实分成了三个阶段分别是鼠标左键按下、鼠标移动、鼠标松开三个步骤。如果是鼠标按键刚刚按下一般只需要记录一下当前的坐标即可。接着在鼠标移动的时候开始绘制图形。等到最终鼠标左键弹起的时候绘图结束所有的shape记录到List当中。 当然除了绘图之外另外一部分比较重要的就是菜单的响应这里建议不同的菜单设置不同的响应函数。虽然麻烦了一点但是可以保证不出错。 4、详细的代码内容 最后为了方便学习和交流这里给出完整的c#代码中间关于图形绘制的内容多了一点菜单部分的内容其实还是比较简单的。 using System; using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Windows.Shapes;namespace WpfApp {public partial class MainWindow : Window{private Point startPoint;private bool isDrawing false;private Shape currentShape;private ListShape shapes new ListShape();// init MainWindowpublic MainWindow(){InitializeComponent();}// mouse down functionprivate void Canvas_MouseDown(object sender, MouseButtonEventArgs e){startPoint e.GetPosition(drawingCanvas);isDrawing true;}// mouse move functionprivate void Canvas_MouseMove(object sender, MouseEventArgs e){if (isDrawing){Point endPoint e.GetPosition(drawingCanvas);if (currentShape null){// Determine the shape type based on the selected menu itemif (menuItemLine.IsChecked){currentShape new Line { Stroke Brushes.Blue, StrokeThickness 2 };}else if (menuItemRectangle.IsChecked){currentShape new Rectangle { Stroke Brushes.Red, StrokeThickness 2, Fill Brushes.Transparent };}else if(menuItemCircle.IsChecked){currentShape new Ellipse { Stroke Brushes.Green, StrokeThickness 2, Fill Brushes.Transparent };}else{currentShape null;return;}drawingCanvas.Children.Add(currentShape);}// Update the coordinates of the shapeif (currentShape is Line line){line.X1 startPoint.X;line.Y1 startPoint.Y;line.X2 endPoint.X;line.Y2 endPoint.Y;}else if (currentShape is Rectangle rectangle){double width endPoint.X - startPoint.X;double height endPoint.Y - startPoint.Y;rectangle.Width width 0 ? width : -width;rectangle.Height height 0 ? height : -height;// record first xif(startPoint.X endPoint.X)Canvas.SetLeft(rectangle, startPoint.X);elseCanvas.SetLeft(rectangle, endPoint.X);// record first yif(startPoint.Y endPoint.Y)Canvas.SetTop(rectangle, startPoint.Y);elseCanvas.SetTop(rectangle, endPoint.Y);}else if(currentShape is Ellipse ecllipse){double width endPoint.X - startPoint.X;double height endPoint.Y - startPoint.Y;ecllipse.Width width 0 ? width : -width;ecllipse.Height height 0 ? height : -height;// judge ecllipse width and heightif(ecllipse.Width ecllipse.Height){ecllipse.Height ecllipse.Width;}else{ecllipse.Width ecllipse.Height;}// record first xif (startPoint.X endPoint.X)Canvas.SetLeft(ecllipse, startPoint.X);elseCanvas.SetLeft(ecllipse, endPoint.X);// record first yif (startPoint.Y endPoint.Y)Canvas.SetTop(ecllipse, startPoint.Y);elseCanvas.SetTop(ecllipse, endPoint.Y);}else{return;}}}// mouse up functionprivate void Canvas_MouseUp(object sender, MouseButtonEventArgs e){isDrawing false;if (null ! currentShape){shapes.Add(currentShape);currentShape null;}}// sub menu functionprivate void MenuItemLine_Checked(object sender, RoutedEventArgs e){menuItemLine.IsChecked true;menuItemRectangle.IsChecked false;menuItemCircle.IsChecked false;}// sub menu functionprivate void MenuItemRectangle_Checked(object sender, RoutedEventArgs e){menuItemLine.IsChecked false;menuItemRectangle.IsChecked true;menuItemCircle.IsChecked false;}// sub menu functionprivate void MenuItemCircle_Checked(object sender, RoutedEventArgs e){menuItemLine.IsChecked false;menuItemRectangle.IsChecked false;menuItemCircle.IsChecked true;}} } 5、结束彩蛋部分 另外建议大家可以多使用类似chatgpt的工具来学习c# wpf这样你给它提示关键字通过不断的交流最终一定可以实现你想要的效果。这比单纯的搜索引擎学习效率要高得多。
http://www.huolong8.cn/news/394286/

相关文章:

  • 做美术鉴赏网站的心得在线短网址生成工具
  • 网站公司怎么做业务织梦做的网站图片路径在哪
  • 怎样做游戏网站做网站必须要公网ip
  • 班级网页网站建设开发手机网站用什么好
  • 现在从事网站开发如何搭建论坛需要多少钱
  • 商家网站建设湛江制作网站学校
  • 宁夏银川网站建设dw网页制作教程自我介绍代码
  • 建设信用卡申请进度查询官方网站现在个人网站怎么备案
  • 建设企业网站步骤做婚礼邀请函网站
  • 网站开发net源码wordpress 微信采集器
  • 网站建设的用户体验电子商务网站建设实验报告心得
  • 山东菏泽建设银行网站猪八戒网设计官网
  • 全网营销推广网站建设腾讯学生服务器可以做网站吗
  • 网站跟网页的区别是什么青岛网站快速排名优化
  • 企慕网站建设网络推广陕西网站建设营销推广
  • 上海做网站的故事哪家好企业咨询服务合同范本
  • 广告设计网站排行榜前十名wap建站系统php版
  • 淇县住房和城乡建设局网站廊坊网站制作建设
  • 搭建网站属于什么专业利用wordpress做api提供者
  • 设计公司网站需要什么条件网站建设phpcms
  • ai做的比较好的网站wordpress商城微信支付
  • 网站建设国家有补贴吗游戏加盟公司
  • 千灯做网站怎么在公司网站做超链接
  • 6网页设计的网站网站制作 培训
  • 门户移动网站建设中华住房与城乡建设厅网站
  • 通许网站建设pda智能巡检系统
  • 菏泽北京网站建设中国制造网外贸站
  • 犀牛云做网站怎么做投资域名后悔死了
  • 网站备案 机构需要什么手续wordpress koncept 下载
  • 专注手机网站建设wordpress 类似 免费