To implement the control array by modifying the form file in Delphi

Source: Internet
Author: User

In the application of Delphi development, each form has a corresponding form file (. dfm) that records the properties of the form and the properties of all the controls on the form so that the form can be rebuilt exactly after the form is closed. Almost all Delphi reference books do not mention the details of the document, occasionally mentioned, also all generalities, because the form file is a binary file, only in the editing environment provided by Delphi can see its true nature, the operation of which may have unpredictable errors; , there is no need to modify it. This article is about the same as the form file.

To take advantage of a form file, you must first understand the structure of that type of file. Form file structure is very simple, friends can generate a form, casually put some controls, save the Unit1.dfm file opened, you can see the form file is the keyword "object" and "end" of the code snippet, the basic structure is as follows:

object 控件名 :类名
属性1 =属性值
属性2 =属性值

end

and supports nesting. Delphi records the properties of the control, only the modified properties, for example, for example, the default description of a Label control (LABEL1) is as follows:

object Label1: TLabel
Left = 256
Top = 80
Width = 32
Height = 13
Caption = Label1
End

The five attributes of the record vary with the location and order of the developer's drag-and-drop, and the other attributes are default values because they have not been modified, so you do not have to record them.

The form file is ordered, and its orderly performance is as follows:

object 窗体名:Tform
窗体属性1=属性值
窗体属性2=属性值
     。。。 。。。
// 以下是TgraphControl类型的控件
object 控件名:类名
控件属性1=属性值
控件属性2=属性值
    。。。 。。。
end
object 控件名:类名
控件属性1=属性值
控件属性2=属性值
    。。。 。。。
end
    。。。 。。。
// 以下是TwinControl类型的控件
object 控件名:类名
控件属性1=属性值
控件属性2=属性值
     。。。 。。。
end
object 控件名:类名
控件属性1=属性值
控件属性2=属性值
     。。。 。。。
end
    。。。 。。。
// 以下是其它类型的控件
object 控件名:类名
控件属性1=属性值
控件属性2=属性值
     。。。 。。。
end
     。。。 。。。
        end

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.