How do you make a customized control that does not display on the windows form, like the SerialPort or the BackgroundWorker or ImageList control?
Inherit from Component rather than Control.
Add a new class to your project and paste the code shown below. Compile. Drop the new component from the top of the toolbox onto the form. Embellish as desired.
using System;
using System.ComponentModel;
[DefaultProperty("Aardvark")]
class MyFoo : Component {
public MyFoo() { }
public MyFoo(IContainer container) { container.Add(this); }
[DefaultValue(0)]
public int Aardvark { get; set; }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With