Custom Control Overriding Command Button?

Width and Height are not virtual members (check Control class in Reflector ), so the simpliest way is to override DefaultSize property.

Width and Height are not virtual members (check Control class in Reflector), so the simpliest way is to override DefaultSize property: protected override Size DefaultSize { get { return new Size(840, 340); } } You can also use new modifier, but for this example I recommend to override DefaultSize. If you check Control class in Reflector you will see, that Height and Width use a lot of internal/private members. So I don't that implementing all those things is a good idea.

Just use DefaultSize property.

You don't necessarly need reflector to check classes methods/definitions/modifiers/etc. You can simply view the class metadata in visual studio by clicking "Go to definition" in the context menu over the word "Control" or whatever type you need to check ;) – digEmAll Apr 25 '10 at 13:25 Well... I don't like to view metadata only. I'm using resharper + scout plugin and it's great. New reflector has some features and you can go directly to this tool from code and check the implementation, but scout is better I think.

But new Resharper (v 5.0) is the best - you can watch compiled assemblies source code directly from VS :D – Jarek Apr 25 '10 at 13:52.

First, note that the DefaultValueAttribute does not actually set default values! This attribute is only used by the Windows Forms Designer to know if it should display a property in the Properties window with a regular or bold font; if a property has a different value from the argument supplied to DefaultValueAttribute, the property is displayed with a bold font. In order to set a default size, you can either: override the DefaultSize property (as shown in @Jarek's answer), or set the Size property in the constructor (though this solution is not as elegant).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions