Hello Everybody!

I've the following issue, and just cannot figure it out myself:

I've a button, which's width and height can be set by numericupdowns. To prevent the button's text truncating, I've also set the minimumvalues, like this:

NumericUpDownWidth.Minimum = Convert.ToInt32(Button1.Width);
NumericUpDownWidth.Value= Convert.ToInt32(Button1.Width);

NumericUpDownHeight.Minimum = Convert.ToInt32(Button1.Height);
NumericUpDownHeight.Value= Convert.ToInt32(Button1.Height);

The one with the Width property works perfectly well, but the Height always shows the button's default height value (24), doesn't matter what is the real height.

I've build in some debug, and with a label, could actually read in and show the real height attribute, but this numericupdown just refuses to do so.

Any suggestions what could cause this?
I'd appreciate any help.

Thanks in advance!

Strange indeed, but setting the font size (say 72)of this control does set the Height also.

Thanks, I've noticed that also. But after I've changed the font size, run the quoted lines (NumericUpDownHeight.Value = Button1.Height; ) the value sets to 24, and the button's height also, so I can only see the upper corner of the text. But the width property works perfectly well.

So, the problem still exist..

Any other suggestions?

When you come to think of it, it is not so strange after all. You can not set the height and width of a checkbox either. What would be the purpose of one giant checkbox on your screen? You could try to derive a class from your control and override the Onpaint method.
In design mode you can see if you can set the height or width of a control. Look at the white handles. A numericupdown control has only handles to set the width.

Thank the advice.

In the meantime, I've figured it out. The problem was that two events were raised in the same time, which I haven't noticed, and it has absolutely nothing to do with the button.

But I find it strange that the width property worked well, it shouldn't have..

Sorry for wasting your time!

Don't feel sorry. Time is always wasted...