C# 设计器流程图应用程序 - 如何?

发布于 2024-09-25 10:07:05 字数 353 浏览 5 评论 0原文

你好 我是 C# WPF 新手。 有一个用 C# 编写的流程图 WPF 程序。 该程序可以显示对象以及它们之间的连接箭头。 即例如

========           ========
|      |           |      |
| obj1 |  ------>  | obj2 |
========           ========

1 - 右键单击​​每个对象时如何为每个对象添加视觉功能? 即,当我右键单击一个对象时,我希望能够更改其属于应用程序的属性。

2 - 如何创建和生成包含上述对象的关系信息的文件。即 obj1 流向 obj2

感谢您分享您的想法

Hi
I'm new to C# WPF.
There's a flowchart WPF program in C#.
The program can display objects and connecting arrows between them.
ie eg

========           ========
|      |           |      |
| obj1 |  ------>  | obj2 |
========           ========

1 - How do I add a visual function to each object when right clicking them ?
ie when I right mouse click an object, I like to be able to change its properties belonging to an application.

2 - how do I create and generate a file containing the relationship information about the objects above. ie obj1 flows to obj2

Thanks for sharing your thoughts

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

回忆追雨的时光 2024-10-02 10:07:05

1)您需要编写在鼠标单击事件中使用的命中测试代码。您需要检查每个对象的屏幕位置,以确定单击鼠标时哪些对象(如果有)位于指针“下方”。从那里您可以显示您想要实现的功能的相应上下文菜单。

2) 如果您只想保存信息以便稍后由应用程序重新打开,则简单的序列化为 XML 或二进制就可以了。如果目的是制作用户可读的内容,您将需要编写一个简单的 csv 导出,或者如果输出需要更复杂,则需要编写一个自定义序列化程序。

更多信息:

命中测试是评估单击了哪个对象的通用术语,例如,当您单击 DataGridView 时,命中测试逻辑可以告诉您单击了哪个单元格/行/列。许多 Widget 类(包括 DataGridView)都有一个 HitTest 方法,该方法将返回一个提供此信息的对象。如果流程图工具对连接的对象使用自定义绘图,那么您将必须使用单击坐标来确定流程图中的哪个元素被单击。

http://msdn.microsoft.com/en -us/library/system.windows.forms.datagridview.hittest.aspx 记录 DataGridView 的 HitTest 方法。

http://www.codeproject.com/KB/list/CSharpHitTest.aspx是 CodeProject 上的一个示例程序,它在 ListView 中执行测试逻辑。

1) You will need to write hit-testing code to be used in the mouse click event. You need to check the screen location of each of your objects to determine which (if any) of the objects was "under" the pointer when the mouse was clicked. From there you can display the appropriate context menu for the functionality you want to implement.

2) If you just want to save the information to re-open by the app later, simple serialization to XML or Binary will work fine. If the intent is to make user-readable content, you will need to write a simple csv export or if the output needs to be more complex, a custom serializer.

More Info:

Hit-testing is the general term for evaluating what object has been clicked on, for example, when you click in a DataGridView, hit testing logic can tell you which cell/row/column was clicked on. Many Widget classes, including DataGridView, have a HitTest method which will return an object which provides this information. If the flowcharting tool uses custom drawing for the connected objects, then you will have to do the work of using the click coordinates to determine what element in the flowchart has been clicked on.

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.hittest.aspx documents the HitTest method for the DataGridView.

http://www.codeproject.com/KB/list/CSharpHitTest.aspx is a sample program on CodeProject which does hit testing logic in a ListView.

何时共饮酒 2024-10-02 10:07:05

1 - 处理对象的鼠标单击事件,并执行您必须执行的操作。
2 - 将对象图序列化为 XML 或二进制格式。

1 - Handle the mouse click events for the objects, and do whatever you have to do.
2 - Serialize the object graph to XML or binary format.

埋葬我深情 2024-10-02 10:07:05

我不确定您的应用程序如何工作以及您使用了哪些控件,但我建议您查看以下文章,这些文章使用您提到的功能实现设计 -

http://flowpad.codeplex.com/

WPF 图表设计器

http://simulo.codeplex.com/

I am not sure how your application works and what controls you have used but I would suggest you to look at following articles implementing designes with the features you mentioned -

http://flowpad.codeplex.com/

WPF Diagram Designer

http://simulo.codeplex.com/

梦里南柯 2024-10-02 10:07:05

来自 Git 的简单库 https:/ /gridwizard.wordpress.com/2015/03/25/simple-c-library-to-render-graph-to-flowchart

它通过首先计算 Node.x/y 和 Canvas 大小(给定)来帮助生成流程图对象图),然后渲染为 HTML5。您可以将代码渲染调整为 WPF(只需添加另一个渲染 - 借用 HTML5 渲染器的代码)。

Simple library from Git https://gridwizard.wordpress.com/2015/03/25/simple-c-library-to-render-graph-to-flowchart

It helps generates flow chart by first calculate Node.x/y and Canvas size (given object graph), then render to HTML5. You can adapt the code render to WPF (simply by adding another render - borrowing code from their HTML5 renderer).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文