I have developed a simple custom control which is effectively a custom button with a timer, derived from Control. I am unsure of using "components = new System.ComponentModel.Container()". Since the control uses a timer, should it be added to the components
container? i.e. components.Add(timer); ? If so, how is it disposed, components.Dispose() is only called if Dispose(true) is called, which i dont? Or should i have a destructor ~MyComponent() which calls timer.Dispose().
In short, when do you use a "components = new Container()" and "components.Add()" in a custom control.
Also, if my control uses Graphics, Brush & Pen objects, should Dispose() be called on them and if so where. In the deconstructor? Or do you leave it up to the garbage collector?
View Complete Post