Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
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?
Posted

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.
 
Share this answer
 
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.
 
Share this answer
 
Comments
Ranald M Engelbeck 17-Jun-13 8:56am    
This looks like the approach I need to be using...seen any examples?
Idle_Force 17-Jun-13 13:20pm    
There is much to learn about this approach. Mouse events, math for moving the objects, then the painting itself. there are many GDI+ tutorials out there. Get started and come back here for help. It is better to solve little parts in forums like this, as it is very hard to do big projects. Plus that shows your willingness to learn and research. Bob Powell is my favorite for GDI+ examples.
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?

[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900