VC # .NET entry classic ------ (special technical understanding) component articles (original)

xiaoxiao2021-03-06  124

9cbs Original article. Author asusharp, if you need to turn, please indicate the author.

We have to understand the differences between several concepts before the explanation of the assembly. That is the component, control, container, and site.

Component

In Microsoft.NET Frameworks. Class is the implementation form of components. In object-oriented programming, all functional code should be encapsulated in a unit module, and components are a granular thing. But components are different from other classes. In order to turn into components, you must implement the System.comPonentModel.icomponent interface. And provide a construction method without parameters. If a class inherits the class of this interface, it will also become a component. Additionally, the component can be included and placed in a container, and when it is placed in a container, it can interact through the venue and container provided by the container.

2. Control (Control)

The control is a component with a user interface (UI). In the .NET Framework, only the class inheritance from System.Windows.Forms.Control or System.Web.ui.Control is a control, both classes implemented the System.comPonentModel.icomponent interface. System.windows.Forms.Control itself provides a UI function, and System.Web.ui.Control provides a framework that can easily join the UI.

3. Container

The container is used to "hold" components, and one container may include one or more components, which are called sub-components of the container. The container is also a class, and a class is to be a container, and the System.comPonentModel.icontainer interface must be implemented, and a construction method without parameters can also be inherited from the class.

4. Places (Site)

The venue is provided by the container, the container uses the venue management sub-assembly and interacts with them. Typically, the containers and places are implemented in the same unit module. A class is to be a place and must implement the System.comPonentModel.isite interface.

When developing Windows Forms or Web Forms components and controls in VS.NET, there is no need to implement containers and places, because Windows Forms Designer and Web Forms Designer are contained in Windows Forms and Web Forms controls.

Components are independent code modules, howyably using components (such as containers)? How do I interact with components? This involves specific programming technology issues. The next lecture will introduce and component design related program design technology. Includes: attributes, events, delegate, feature (Attribute) and authorization. Please pay attention. (Performance: 2004.08.17)

转载请注明原文地址:https://www.9cbs.com/read-126177.html

New Post(0)