Re: OnClick from UserControl Button
- From: "DiamondDave" <DiamondDave@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 31 Jul 2005 01:11:02 -0700
Hi Tim
That was exactly what I needed! Thankyou
You wouldn't be interested in looking at another thread I have going called
"Form component like common Openfiledialog"?
Thanks again
Dave
"Tim Wilson" wrote:
> A UserControl is a composite control. This means that the control is usually
> exposed as other controls simply grouped together. So the reason that you
> have a designer view of the UserControl is to allow you to easily drag and
> drop controls from the ToolBox. In your case, you just want to modify the
> default behavior of a single control. So the best approach would be to just
> inherit directly from this control. The main benefit is that all the events
> and properties of the Button will be directly exposed through your custom
> control since they are inherited. The quick start tutorial, linked below,
> has some useful information on getting started building custom controls.
> http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsCreatingControls.aspx
>
> --
> Tim Wilson
> ..Net Compact Framework MVP
>
> "DiamondDave" <DiamondDave@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:3734BC9F-3504-4BBA-B828-2CEB42A6519D@xxxxxxxxxxxxxxxx
> > Hi Tim
> >
> > I changed the class to be derived from Button instead of UserControl, but
> > there are obviously some other things that need to be changed. Starting
> with
> > a UserControl doesn't seem the best way, but the only other UI option
> seems
> > to be a Form, so now I'm confussed! Any examples you know of that would
> > explain the procedure to a dumbass newbie would be appreciated.
> >
> > Thanks
> > Dave
> >
> >
> > "Tim Wilson" wrote:
> >
> > > So you just want to change the default color of a Button but allow this
> > > control to be reusable from the ToolBox? If so, then you should derive
> your
> > > control directly from the Button class and not from UserControl.
> > >
> > > --
> > > Tim Wilson
> > > ..Net Compact Framework MVP
> > >
> > > "DiamondDave" <DiamondDave@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > > news:93158DD8-A2CB-46AC-90E6-D75BFE04E7C3@xxxxxxxxxxxxxxxx
> > > > Hi There
> > > >
> > > > Another dumb newbie question, sorry. I want to be able to create
> > > > applications by dragging my own version of controls onto a Form. The
> > > reason
> > > > for making say a button as a user control, is I want to button color
> to be
> > > a
> > > > specific color and not the default color. When I drag the Usercontrol
> onto
> > > > the form it all looks fine, but when it executes, the onclick can't be
> set
> > > on
> > > > the usercontrol. I'm guessing the OnClick on the button needs to send
> an
> > > > event to theUserControl so I can get at the onclick event in the
> designer.
> > > >
> > > > Is there a better way to do this?
> > > >
> > > > If this is the best way to do this, do I need to propergate all the
> > > possible
> > > > actions of the control up to the UserControl?
> > > >
> > > > Thanks
> > > > Dave
> > > >
> > >
> > >
> > >
>
>
>
.
- References:
- OnClick from UserControl Button
- From: DiamondDave
- Re: OnClick from UserControl Button
- From: DiamondDave
- OnClick from UserControl Button
- Prev by Date: Lookup Table to select (or multi-select) for edit
- Next by Date: Re: Unusual copyright question
- Previous by thread: Re: OnClick from UserControl Button
- Next by thread: Prevent user from closing form but allow form to close at logout
- Index(es):