creating custom controls... !

  • Thread starter Thread starter Evan Camilleri
  • Start date Start date
E

Evan Camilleri

Thanks to Tim Wilson's article I know some knowledge of buidling a control.

Unfortunately I cannot find much documentation on:

1: DeviceEnumConverter (was trying to look in here to do a property
which lists at design time all tab controls in the form)

2: How can I have the instance of the form that the control is in at
runtime

Evan
 
Hi,

For point 2 you can use something like the following:

Control myctrl = Parent;
while (myctrl != typeof(System.Windows.Forms))
{
myctrl = myctrl.Parent;
}

Regards
Simon.
 
'Parent' does not exist. What I forgot :( to say is that I am using
System.ComponentModel.Component in order for the component to stay in the
Tray.


Evan
 
Till now what I managed to do is to create a contructor
public MyComponent(ContainerControl parentControl)

The only issue is that drag and drop does NOT work from Toolbox to form but
it has to be manually edit to

this.myComponent = new Namespace.MyComponent(this);

i.e. adding the 'this'.

Evan
 
Back
Top