Home All Groups Group Topic Archive Search About

Need a way for the user to add form buttons??????????????????????

Author
23 Nov 2006 6:49 PM
Marc
Hi,

I am writing a program which invloves dragging and dropping things
around a form. I have so far chosen to use Buttons to drag and drop
which works fine. These button actually represent HGV's!

My problem is that I need a way to allow the user to add more 'buttons'
to the form when needed. I also need a way for the user to give these
buttons a text label.

Does anyone know a good way that I can achieve this? I know one problem
i will have is that I may need to modify my drag and drop code
automatically when each new button is added (add handler reference).

Does that makes sense??

Thanks Very Much!

Marc

Author
23 Nov 2006 6:57 PM
Tom Shelton
Marc wrote:
Show quoteHide quote
> Hi,
>
> I am writing a program which invloves dragging and dropping things
> around a form. I have so far chosen to use Buttons to drag and drop
> which works fine. These button actually represent HGV's!
>
> My problem is that I need a way to allow the user to add more 'buttons'
> to the form when needed. I also need a way for the user to give these
> buttons a text label.
>
> Does anyone know a good way that I can achieve this? I know one problem
> i will have is that I may need to modify my drag and drop code
> automatically when each new button is added (add handler reference).
>
> Does that makes sense??
>
> Thanks Very Much!
>
> Marc

Adding a button dynamically isn't that difficult:

Button btn = new Button ()
btn.Text = userText.Text
' add events
addhandler btn.click, addressof theclickhandler
....
btn.location = new point (x, y)
me.controls.add (btn)

The trick is the interface for doing all of this.  Maybe the
System.Windows.Forms.PropertyGrid might be of help to you...

--
Tom Shelton
Author
23 Nov 2006 7:04 PM
Marc
Thanks again Tom!

I'll have a play around with that.


Tom Shelton wrote:
Show quoteHide quote
> Marc wrote:
> > Hi,
> >
> > I am writing a program which invloves dragging and dropping things
> > around a form. I have so far chosen to use Buttons to drag and drop
> > which works fine. These button actually represent HGV's!
> >
> > My problem is that I need a way to allow the user to add more 'buttons'
> > to the form when needed. I also need a way for the user to give these
> > buttons a text label.
> >
> > Does anyone know a good way that I can achieve this? I know one problem
> > i will have is that I may need to modify my drag and drop code
> > automatically when each new button is added (add handler reference).
> >
> > Does that makes sense??
> >
> > Thanks Very Much!
> >
> > Marc
>
> Adding a button dynamically isn't that difficult:
>
> Button btn = new Button ()
> btn.Text = userText.Text
> ' add events
> addhandler btn.click, addressof theclickhandler
> ...
> btn.location = new point (x, y)
> me.controls.add (btn)
>
> The trick is the interface for doing all of this.  Maybe the
> System.Windows.Forms.PropertyGrid might be of help to you...
>
> --
> Tom Shelton