Reprint: use Visual C # to dynamically generate components. Please refer! (1)
Source: Internet
Author: User
Use Visual C # to dynamically generate components
· Ahhu ·
In the past, when I used Delphi to write a program, I did not like to emit many components on the form. This is a bit unsightly, and it is not very convenient to debug the program. When writing a program, when some components are used, they are generally created dynamically and released after use. Visual C # You can also dynamically create components when running the program. The following uses a program example to describe how to use Visual C # to dynamically generate components. First, let's take a look at some introductions and theories that will be used in the process of dynamically creating components.
I. Boxing and Unboxing ):
When using Visual C # to dynamically create a component, two types of data Type variables are involved. These two types of variables are Value types) variable and Reference Type variable, which are called Boxing and Unboxing in Visual C ). Convert the real value type variable to the reference type variable Boxing (boxed). Convert the reference type variable to the actual value type variable Unboxing (Unboxing ). So what is the real value type? Simply put, we usually use integer, Boolean, and enumeration types. These types of variables are real value type variables. The so-called reference type, in Visual C #, Object, Class, Interface, Delegate, String, Array, etc. The main difference between them and actual value types is, reference type variables store pointers to object objects, while real-value variables are actually object objects. In the program described in this article, it mainly involves getting out of the box. The specific processing method is described below.
2. The environment for program design and operation in this article:
(1). Microsoft Windows 2000 Server Edition
(2). Net FrameWork SDK Beta 2
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.