要如何將應用程式轉為ActiveX Form |
缺席
|
BOSS
中階會員 發表:70 回覆:79 積分:64 註冊:2006-11-01 發送簡訊給我 |
|
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
參考: http://pweb.netcom.com/~cherrman/cvtforms.htm
Converting a standard Delphi Form to an ActiveForm
By Conrad Herrmann, 25 July 1997
People ask me this question often, and there are several techniques that can do this. The technique that I prefer is easy to learn and the most flexible. In this technique, you make your existing Delphi form a child window of an otherwise ActiveForm. Because it’s a child form, you’ll have to add code to set some of its properties to reflect that fact—to remove the window frame, to align it to its parent’s client area, etc.
This approach has several advantages. The first advantage is that its easy to get up and running—the only thing you need to do that’s not already done for you is to add code to create and embed your form in the ActiveForm. Another advantage is that unlike copying your code to the ActiveForm’s implementation file, this approach doesn’t change your form’s implementation at all. The code you’re familiar with is still familiar. It also means the form’s implementation unit can still be included in a regular Delphi application if you so desire.
Steps to convert a Delphi form to an ActiveForm:
Create a blank ActiveForm. In the form’s property inspector, add an Create handler like the one shown below:
Procedure TActiveForm1.FormCreate(Sender: TObject); begin // This code creates a child form that is just a normal // Delphi TForm. // This allows the form to be shown both as a normal // VCL form and as an ActiveForm. ChildForm := TForm1.Create( Self ); ChildForm.Parent := Self; ChildForm.Align := alClient; ChildForm.BorderStyle := bsNone; ChildForm.Visible := True; end;In the uses clause, add a reference to your form’s unit (in this case, Unit1). Add the form’s implementation unit to the project (in this case, Unit1.pas). Add the declaration of ChildForm to your TActiveForm1 class, like this: type TActiveForm1 = class ... .... public ChildForm: TForm1; .... end;Compile and test your form. --- 每個人都是一本書 |
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
|
wnhoo
高階會員 發表:75 回覆:443 積分:198 註冊:2003-04-22 發送簡訊給我 |
|
BOSS
中階會員 發表:70 回覆:79 積分:64 註冊:2006-11-01 發送簡訊給我 |
|
Justmade
版主 發表:94 回覆:1934 積分:2030 註冊:2003-03-12 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |