Custom control class defaults ?

P

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
 
B

Ben Voigt

Philipp said:
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...
 
P

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
 
B

Ben Voigt

Philipp said:
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);
 
P

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top