全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1128
推到 Plurk!
推到 Facebook!

請問如何在 Form 中自訂義一個屬性

尚未結案
soulin12
一般會員


發表:22
回覆:21
積分:8
註冊:2003-05-07

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-05-08 14:40:11 IP:61.145.xxx.xxx 未訂閱
我想在 FORM 中自己增加一個屬性,屬性的值我在程序運行時隨意改變,哪位高手幫幫忙呢?
Justmade
版主


發表:94
回覆:1934
積分:2030
註冊:2003-03-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-05-08 15:02:17 IP:218.16.xxx.xxx 未訂閱
Type
  TForm1 = Class(TForm)
    ...
    ...
  private
    MyVar1 : String;      public
    MyVar2 : Integer;      end;
在 private (只本 unit 用) 或 public (所有有 use 本 unit 的都可用) 裡 定義均可
soulin12
一般會員


發表:22
回覆:21
積分:8
註冊:2003-05-07

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-05-08 15:23:55 IP:61.145.xxx.xxx 未訂閱
Justmade先生: 可我想自定義的屬性能夠在 Object Inspector 中顯示出來呢 有辦法嗎?
Justmade
版主


發表:94
回覆:1934
積分:2030
註冊:2003-03-12

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-05-08 16:23:42 IP:218.16.xxx.xxx 未訂閱
Following is originally posted by Jeff Overcash(TeamB)    
引言: 1) Publish the property or event. 2) Add the Custom form to the Object repository. 3) Add the form to a package. 4) Add to the package the following procedure interface ... procedure Register; implementation uses dsgnIntf; ... procedure Register; begin RegisterCustomModule(TMyCustomForm, TCustomModule); end; 5) Create a new form that inherites from your custom form. You should now see the extra events and properties.
wnhoo
高階會員


發表:75
回覆:443
積分:198
註冊:2003-04-22

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-05-08 16:25:38 IP:61.155.xxx.xxx 未訂閱
//引用 unit Unit1; interface uses   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,   Dialogs, StdCtrls; type   TForm1 = class(TForm)     Button1: TButton;     Button2: TButton;     procedure Button1Click(Sender: TObject);     procedure Button2Click(Sender: TObject);   private     { Private declarations }   public        { Public declarations }   end; var   Form1: TForm1; implementation uses unit2; {$R *.dfm}    procedure TForm1.Button1Click(Sender: TObject); begin Unit2.myvar:=application.Title ; Unit2.mymessage; end;    procedure TForm1.Button2Click(Sender: TObject); begin Unit2.myvar:='45654655'; Unit2.mymessage; end;    end.    //定义 unit Unit2; interface uses Dialogs;    procedure mymessage; var   myvar:string; implementation procedure mymessage; begin showmessage(myvar); end; end.    风花雪月 e梦情缘
------
风花雪月 e梦情缘
系統時間:2024-06-29 9:16:29
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!