Difference btn Component Class & Custom control

Tweety

New member
Joined
Jul 4, 2003
Messages
2
Location
India
Hi,
I am exploring development of controls in Windows Forms -C#.Would like to know what is the difference between CustomControl Class & the Component Class.when do i use which?(This is when i do a add/ new item /...
Thanks !
 
*Custom Control class is used to create custom controls:p. There are several types. These are mainly used for UI(User Interface) capabilities.

For example:

  1. You can create an inherited custom control that inherits lets say a DataGrid. Once you do this you have inherited all the functionality of the DataGrid (System.Windows.Forms.DataGrid). Now you are able to add more functionality to the control i.e.(methods, properties, etc.). These are a great time saver if you are in an environment where you do a lot of repetitious coding for certain controls. You can bundle these controls into a separate project and include it when needed.
  2. You can also create custom user controls. These controls inherit the UserControl class. By default you are given a gray canvas to start drawing your control on. From there you can use any of your controls in your toolbox to create your control and give it functionality.
  3. You can also create your own custom controls that inherit the System.Windows.Forms.Control class. You write all of the logic behind this type of control.
    [/list=1]

    *The Component Class is used as an external resource or to hold other components that you might want to access their design-time functionality. A good example would be say a timer component.
 
Last edited by a moderator:
Back
Top