微科社区,轻松开发从此开始! 请登陆 免费注册

微科社区

当前位置:首页 > 编程语言 > Delphi >

类信息查看

时间:2017-02-20 03:32  浏览:努力统计中...
unit Unit2;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Buttons;type TinfoForm = class(TForm) Label3: TLabel; ListClasses: TListBox; Panel1: TPanel; Label1: TLabel; La

\"\"

unit Unit2;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, StdCtrls, ExtCtrls, Buttons;type  TinfoForm = class(TForm)    Label3: TLabel;    ListClasses: TListBox;    Panel1: TPanel;    Label1: TLabel;    Label2: TLabel;    ListParent: TListBox;    EditInfo: TEdit;    procedure FormCreate(Sender: TObject);    procedure ListClassesClick(Sender: TObject);  private    ClassArray: array of TClass;  public    { Public declarations }  end;var  infoForm: TinfoForm;implementation{$R *.dfm}procedure TinfoForm.FormCreate(Sender: TObject);var i: Integer;begin  SetLength(ClassArray,50);  ClassArray [0] := TButton;  ClassArray [1] := TBitBtn;  ClassArray [2] := TEdit;  ClassArray [3] := TSpeedbutton;  ClassArray [4] := TRadioButton;  ClassArray [5] := TRadioGroup;  ClassArray [6] := TPanel;  ClassArray [7] := TCheckBox;  ClassArray [8] := TForm;  ClassArray [9] := TComboBox;  ClassArray [10] := TGroupBox;  ClassArray [11] := TSpeedButton;  ClassArray [12] := TLabel;  ClassArray [13] := TListBox;  ClassArray [14] := TMemo;  for I := 0 to 15 do   ListClasses.Items.Add(ClassArray[i].ClassName);  ListClasses.ItemIndex := 0; ListClassesClick(nil);end;procedure TinfoForm.ListClassesClick(Sender: TObject);var MyClass: TClass;begin   MyClass := ClassArray[ListClasses.ItemIndex];   EditInfo.Text := Format(\'Name:%s - Size:%d\',[MyClass.ClassName,MyClass.InstanceSize]);   ListParent.Clear;   with ListParent.Items do   begin      while MyClass.ClassParent <> nil do      begin         MyClass := MyClass.ClassParent;         Add(MyClass.ClassName);      end;   end;end;end.
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线------
栏目列表
推荐内容