Size of Custom Control

  • Thread starter Thread starter Mike Endys
  • Start date Start date
M

Mike Endys

Hi all,
i have my own control, but the initial size after dropping to the form is
allways 200x200px.
How to change this initial values? I wanna set my own control size to be set
immedately after dropping control to the form.

Thanks for answers.
M.
 
It is not working. I have Size property set in constructor, after
InitializeComponent(), or in the InitializeComponent()...

private void InitializeComponent()
{
this.SuspendLayout();
this.Size = new System.Drawing.Size(100, 20);
// I tryied base.Size = new System.Drawing.Size(100, 20);

this.ResumeLayout(false);
}


Nothing working... the control seems like that it is drawed with my size
after dropping on the Form, but in a little time it is resized to the
200x200px


Because the control is completely painted by self, maybe i have to override
some method... but.. Im trying all... nothing helps.

M.
 
Im using.. but.. it seems, that this size is defined by base Control
class... but.. I dont know... where to change it to override the base class
settings... :(
 
I had this issue too. If the size is defined in the base class, it
can't be changed. To get around this, I changed the base class to not
define the size - you may need to remove some windows generated code -
I had to manually code a lot. Then added the size as a parameter in
the base class constructor. It's a bit of a pain, but it does work.
 
Damn!!!

Who gues that it is so complicated... well... I have to write my own base
control...

I had this issue too. If the size is defined in the base class, it
can't be changed. To get around this, I changed the base class to not
define the size - you may need to remove some windows generated code -
I had to manually code a lot. Then added the size as a parameter in
the base class constructor. It's a bit of a pain, but it does work.
 
Back
Top