C#.net中的寡妇应用程序代码 [英] widows application code in C#.net

查看:90
本文介绍了C#.net中的寡妇应用程序代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在申请建筑行业,因此使用了流程图.因此,当我有一个矩形然后拖动一条线时,只要它到达矩形,我就希望选择或突出显示矩形表面.

将等待建议.

(我尽力编辑了此内容,但其中涉及猜测-如果我猜错了,您需要重新措词-_Maxxx_):)

I''m making an application for the construction industry, so using flowcharts. So when I have a rectangle and then I drag a line, as soon as it reaches to the rectangle I want rectangle surface get selected or highlighted.

Will wait for suggestion.

(I edited this as best I could, but there was guesswork involved- if I guessed wrong you''ll need to rephrase it- _Maxxx_) :)

推荐答案

如果您可以在Internet上搜索 c#图表设计器,您会发现很多带有源代码的示例,您可以从中找到想法.

CP上有几对,例如 sukram的这四部分文章 [ ^ ],尽管该程序需要WPF.
If you do an internet search for c# diagram designer you will find lots of examples with source code that you can look at for ideas.

There are a couple here on CP such as this 4 part article by sukram[^], although that one requires WPF.


您将必须检查直线是否在所拥有的任何矩形的任何部分上-假设您可以从任意点抓取直线.假设您只想在直线的端点之一上方突出显示矩形,则需要迭代矩形集合,将左上角和右下角与直线的端点进行比较;如果端点在矩形内部,并且矩形未突出显示,则将其突出显示;相反,如果端点不在矩形内,而是突出显示了矩形,则需要取消突出显示它(假设只允许一个可突出显示的对象)
我想突出显示您只是想更改颜色或轮廓-这应该是微不足道的;如果您无法做到这一点,那么您的项目确实对您的技能过于雄心勃勃.
我个人将整个事情抽象化-这样您就有了代表流程图项的对象的集合,以及绘制它们的方法;然后,您可以拥有这些对象的属性,例如IsHightlighted,这将对我有所帮助.
You''ll have to check whether the line is over any part of any of the rectangles you have - assuming you can grab the line from any point. Assuming you only want the rectangle highlighted if one of the line''s end points are over it, then you''d need to iterate your collection of rectangles, comparing top left and bottom right with the line''s endpoints; if the endpoint is inside the rectangle and the rectangle is not highlighted, then highlight it; conversely if the endpoint is not inside the rectangle but the rectangle is highlighted, you need to de-highlight it (assuming only one highlightable object is allowed)
I assume for highlighting you just want to change the colour or outline - that should be trivial; if you can''t do that then really your project is over ambitious for your skills.
Personally I would abstract the whole thing - so you have a collection of objects representing the flowchart items, and a method for them to be drawn; you can then have properties of these objects, such as IsHightlighted, which will help I think.


这篇关于C#.net中的寡妇应用程序代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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