VB.Net事件和重叠图形控件的焦点 [英] VB.Net Events and focus of overlapping graphics controls

查看:123
本文介绍了VB.Net事件和重叠图形控件的焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在编写一个为Excel启用COM的VB.Net GDI图形数字转换器控件。它有一个橡皮筋矩形控件,用于定义世界坐标系,并包含我想要进行控制的可编辑样条曲线的Generic.List。这些数字化仪控件中的一个以上可用于Windows窗体或控件的Excel工作表。



我的问题是这些控件构建的UserControl表面会故意交叠。这可以防止被覆盖的控件聚焦于编辑或触发事件。



CAD软件会定期执行此操作。有没有看到任何解决这个问题的例子?

Hi,
I am writing a VB.Net GDI graphics digitizer control that is COM enabled for Excel. It has a rubber band rectangle control defining the world coordinate system and contains a Generic.List of editable splines I want to make controls. More than one of these digitizer controls can be used on an Excel worksheet of windows forms or controls.

My problem is that the UserControl surface these controls are built on will intentionally overlap. This prevents the covered controls from getting focus for editing or triggering events.

CAD software does this routinely. Anyone out there seen any examples solving this problem?

推荐答案

CAD软件不对每个对象/行/矩形使用控件。您使用一个称为曲面的控件并在该曲面上绘制。然后你做自己的对象管理。



程序可以拥有的GDI对象数量有限制,每行使用一个对象/绘图对象会很快让你达到极限。



this [ ^ ]



和其他人通过搜索Drawing Canvas .NET Winforms在谷歌。
CAD software doesn't use controls for each object/line/rectangle. You use one control called a surface and draw on that surface. You then do your own object management.

There is a limit to the number of GDI objects a program can have, and using one object per line/drawing object will quickly get you to the limit.

See this[^]

And others by searching for "Drawing Canvas .NET Winforms" on google.


使用GDI +,我处理存储对象的方式是使它们成为自定义类,然后将这些自定义类存储在List(Of T)中。然后,您可以迭代鼠标事件中的列表以找到它们并绘制手柄然后用于移动或调整它们。在绘图事件中,您只需迭代列表并根据存储在自定义对象中的值进行绘制 - 如坐标,颜色,手柄位置等...



At至少,如果我理解你的顾虑。
With GDI+, the way I handled storing objects was to make them a custom class, then you store these custom classes in a List(Of T). Then you can iterate the list in the mouse events to locate them and paint handles then you use to move or adjust them. In the paint event you just iterate the list and paint based on values you stored in the custom object - like coordinates, color, handle locations, etc...

At least if I understand your concerns.


那么,这是令人沮丧的......所以你如何管理未知数量的可编辑样条对象,如下面CodeProject链接中讨论的那样?显然不仅仅是管理Generic.List。如何在没有样条抛出某种事件的情况下在用户指向的对象上捕获事件?



[ ^ ]
Well, that is discouraging....so how do you go about managing an unknown number of editable spline objects like the one discussed in the CodeProject link below? Obviously something more than managing a Generic.List. How do you trap events on the object the user is pointing at without the spline throwing some sort of event?

[^]


这篇关于VB.Net事件和重叠图形控件的焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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