Jump to content
  • Advertisement
Sign in to follow this  
UnshavenBastard

[.net] "rubber band" etc as control?

This topic is 4324 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hallo, I have a user control that, by now, draws several entities directly on the control's surface. also, the entities are interconnected here and there, the connectors a also just drawn with GDI+ directly on the usercontrol. (all in .NET 1.1 btw.). Time has come where the direct drawing of the entities are no longer feasible, and I need to change them into controls for allowing more sophisticated behaviour without reinventing a whole collection of different wheels. For obvious reasons, drawing the interconnections and some kind of selection frame aka "rubber band", directly on the form, is no longer feasible as well. What would be the best way to do a selection frame and those connection lines (some straight, some weirdly angled) in .NET? Are there special line drawing methods for this, that can deal with controls sitting on my usercontrol, or can I even implement weirdly shaped connections as own controls (efficiently)? I'm curious. Thanks in advance, unshaven

Share this post


Link to post
Share on other sites
Advertisement
I've never done something like this myself, but if I was to do it I'd probably arrange it to have a container control and child controls (much like the relationship between a TabContol and the TabPages that appear on it). I wouldn't want to try and implement it as free-floating child controls with other discrete "connector" controls between them, it sounds like it would be both nightmarish to implement and inefficient.

Quite a few controls expose the RenderToBitmap() method; so using GDI+ to handle the connector and control drawing would seem simple enough.

Reading back your post I can't work out whether I'm stating the obvious or not, but there you go. [rolleyes]

Share this post


Link to post
Share on other sites
You could try drawing none straight lines by using paths, and you could also try to only dirty the rectangle you know needs updating graphics wise, rather than invalidating the whole client area, if you're suffering from a draw performance hit.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!