Home All Groups Group Topic Archive Search About

Custom control class defaults ?

Author
29 May 2006 1:55 PM
Philipp
Hi NG,

I made some custom control classes, for example a "CommonButton" ... Now I
want the button be larger than the default width and height.
It works at runtime (by overriding the InitLayout) ... but I also want it at
design time when I drag the "CommonButton" on a form ... It always has the
default size/name/etc.

Anyone have any suggestions ?

Thanks in advance!

Greets,
Philipp

Author
29 May 2006 5:25 PM
Ben Voigt
"Philipp" <sty***@hotmail.com.invalid> wrote in message
news:uWcJTeygGHA.4080@TK2MSFTNGP03.phx.gbl...
> Hi NG,
>
> I made some custom control classes, for example a "CommonButton" ... Now I
> want the button be larger than the default width and height.
> It works at runtime (by overriding the InitLayout) ... but I also want it
> at design time when I drag the "CommonButton" on a form ... It always has
> the default size/name/etc.

The default size when you drag a custom control onto a form is the size of
the control when you compiled it...

Show quote
>
> Anyone have any suggestions ?
>
> Thanks in advance!
>
> Greets,
> Philipp
>
Author
30 May 2006 6:57 AM
Philipp
> The default size when you drag a custom control onto a form is the size of
> the control when you compiled it...

It's a component class, how do I set the size in the code ?

Thanks

Philipp
Author
30 May 2006 6:16 PM
Ben Voigt
"Philipp" <sty***@hotmail.com.invalid> wrote in message
news:OPzvZZ7gGHA.4708@TK2MSFTNGP04.phx.gbl...
>
>> The default size when you drag a custom control onto a form is the size
>> of
>> the control when you compiled it...
>
> It's a component class, how do I set the size in the code ?

A component.... typically doesn't have a size.  What is the base class?

You typically set the size in the designer using the drag handles, and the
designer writes a line of code in the InitializeComponent() method in the
mycontrol.Designer.cs file.

Looks something like:
this.ClientSize = new System.Drawing.Size(292, 268);


Show quote
>
> Thanks
>
> Philipp
>
Author
31 May 2006 6:10 AM
Philipp
> You typically set the size in the designer using the drag handles, and the
> designer writes a line of code in the InitializeComponent() method in the
> mycontrol.Designer.cs file.
>
> Looks something like:
> this.ClientSize = new System.Drawing.Size(292, 268);

That's it!
I had that piece of code in the wrong place ...
Thanks!!!

Philipp

AddThis Social Bookmark Button