C#项目绘图网络图 [英] C# project -drawing network diagram

查看:83
本文介绍了C#项目绘图网络图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好......

i需要你的帮助...如何创建像思科数据包跟踪器或GNS3或任何其他应用程序的网络模拟器环境......我的观点只是建立环境支持拖放以建立网络图和链接以获得连接

Hi guys ...
i need your help ... how to create a network simulator environment like Cisco packet tracer or GNS3 or any other applications ... my point is just to build environment support drag and drop to make network diagram and links to get connection

推荐答案

我宁愿建议使用WPF和 Canvas 您可以将元素放在任意位置,以构成模式。请查看我过去的答案:

在C#.Net WinForms / WPF 中合成/混合视频的方法或框架[ ^ ],

矢量图形软件,如CorelDraw或C#或VB.NET中的Inkscape [ ^ ],

连接不同的控件 [ ^ ]。



这不是 System.Windows.Forms 中的问题,但你必须自己渲染图形。图形以重写方法 Control.OnPaint 呈现,或者,事件的处理程序 Control.Paint 。它可以是一些自定义控件,甚至是表单。基本上,您必须将图形的矢量模型保留在内存中,并使用这样的处理程序将其渲染到某个控件。你必须开发模型并自己渲染。该模型应全面描述您架构的所有几何。当您需要更改模式数据中的某些内容时(通过 Control.Invalidate 方法之一),使整个客户区无效,或者选择矩形区域

https://msdn.microsoft.com/en-us/library/system.windows.forms.control。 onpaint(v = vs.110).aspx [ ^ ],

https://msdn.microsoft.com/en-us/library/system.windows.forms.control.paint(v = vs.110).aspx [ ^ ],

https://msdn.microsoft.com/en-us/library/system.windows.forms.control.invalidate%28v=vs .110%29.aspx [ ^ ]。



除此之外,还需要实现编辑(使用命中测试用于确定您要点击的元素),绘制编辑工件(选择,控制/变换标记,标尺等等),缩放,平移/滚动等。请查看我过去的答案:

什么样的俏皮方法是Paint? (DataGridViewImageCell.Paint(...)) [ ^ ],

在面板上捕获绘图 [ ^ ],

mdi子表单之间的绘制线 [ ^ ],

C#.net鼠标滚轮中的缩放图像 [ ^ ],

如何加速我的vb.net应用程序? [ ^ ],

对于有两个独立列的组合框的任何方式? [ ^ ]。



-SA
I would rather suggest using WPF and Canvas where you can put your elements in arbitrary locations, to make up your schema. Please see my past answers:
Methods or frameworks for compositing/blending videos in C# .Net WinForms/WPF[^],
Vector graphics software like CorelDraw or Inkscape in C# or VB.NET[^],
Connect different controls[^].

This is not a problem in System.Windows.Forms, but you have to render graphics by yourself. The graphics is rendered in the overridden method Control.OnPaint, or alternatively, a handler of the event Control.Paint. It can be some custom control, or even the form. Basically, you have to keep the vector model of your graphics in memory and render it to some control with such a handler. You have to develop the model and rendering yourself. The model should comprehensively describe all the geometry of you schema. When you need to change something in the data of the schema, which is done by one of the methods Control.Invalidate, to invalidate the whole client area, or selected Rectangle or Region:
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.onpaint(v=vs.110).aspx[^],
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.paint(v=vs.110).aspx[^],
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.invalidate%28v=vs.110%29.aspx[^].

On top of it, you need to implement editing (with the hit test used to determine what elements you are clicking), drawing of editing artifacts (selection, control/transform marks, rulers, and a lot more), zooming, panning/scrolling, and so on. Please see my past answers:
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
capture the drawing on a panel[^],
Drawing Lines between mdi child forms[^],
Zoom image in C# .net mouse wheel[^],
How to speed up my vb.net application?[^],
Any way for a combo box with two separate columns?[^].

—SA


这篇关于C#项目绘图网络图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆