Redesigning a Form

All topics not related to another forum.

Moderators: Phil Wright, Chris Porter

Redesigning a Form

Postby FrankM » Fri Feb 27, 2009 5:43 am

I don't think this a Krypton specific question but here it goes.
Does anyone know about a way to cut and re-paste the objects on a form without them losing their link with the code (event, etc.)?

For example, I have a form with all the objects on it. One or more of these objects have an event linked to a method.
After the fact, I realize that I would like to put all these object in a splitter and to do so, I have the cut all the objects, place the splitter and then paste the objects back in the splitter.
It works as fas as design but every time I have to reestablish the object's event link with code.

Is there a trick that prevents the link with the code from being broken?
Thanks,

FrankM
FrankM
 
Posts: 19
Joined: Tue May 27, 2008 12:02 pm

Re: Redesigning a Form

Postby Chris Porter » Fri Feb 27, 2009 6:45 am

2 ways to go:

1) Setup all your event handlers in code. This is ultimately more reliable and controllable than design-time event bindings.

2) Drag the controls from their current container to another area on the form or another container. Easiest way if you have controls that are docked to Fill is to remove the dock setting, drag on your split container, drag your controls to the split container, and then set your dock back to fill.
Chris Porter
 
Posts: 714
Joined: Fri Oct 12, 2007 5:39 am
Location: Oklahoma City, OK, US

Re: Redesigning a Form

Postby FrankM » Fri Feb 27, 2009 7:36 am

I knew about handling the events in the code; although I like that way, it's too late in the game for me to apply it everywhere.
I've tried the dragging before but I was certainly doing something wrong. Tried now and it worked.
Thanks Chris. Definitely think of solution 1) for my next project.

Frank M
FrankM
 
Posts: 19
Joined: Tue May 27, 2008 12:02 pm

Re: Redesigning a Form

Postby Chris Porter » Sat Feb 28, 2009 1:29 am

I'm glad #2 worked for you. #1 is the way I prefer, but I'd be lying if I said that I follow that method consistently. I have quite a few winforms that are all design-time configured eventing and I've spent way too much time rewiring when I cut/paste instead dragging.
Chris Porter
 
Posts: 714
Joined: Fri Oct 12, 2007 5:39 am
Location: Oklahoma City, OK, US


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron