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

Dll封装窗体载入的大小如何随其主窗体Panel大小改变而改变?

答題得分者是:pceyes
chuyuan888
一般會員


發表:2
回覆:0
積分:0
註冊:2006-12-17

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-08-07 13:49:19 IP:116.24.xxx.xxx 訂閱
我Dll封装了一个窗体,可以载入主窗体的Panel1中,可是不仅载入时的大小不施用Panel1的大小,而且也不随Panel1的大小改变而改变,请高手帮助
pceyes
尊榮會員


發表:70
回覆:657
積分:1140
註冊:2003-03-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2008-08-07 15:15:10 IP:220.141.xxx.xxx 訂閱
方法有兩種
1. 將panel的Top, Left, width, height的值傳入Dll之中。
2. 直接將panel傳入dll,dll也可以得到panel的位置。
3. 最笨的方法,看要Sendmessage將位置傳給dll form或將值寫入file(file mapped or Text file) 。
------
努力會更接近成功
bill534
一般會員


發表:38
回覆:51
積分:17
註冊:2007-02-22

發送簡訊給我
#3 引用回覆 回覆 發表時間:2009-11-20 14:04:14 IP:125.230.xxx.xxx 訂閱
Dear
有試過一個DLL封裝數個FORM嗎?
pceyes
尊榮會員


發表:70
回覆:657
積分:1140
註冊:2003-03-13

發送簡訊給我
#4 引用回覆 回覆 發表時間:2009-11-20 19:23:54 IP:220.141.xxx.xxx 訂閱
最近剛好在做這件事,把常用的Function都封成各個Dll,然後拿給pascal script去呼叫,簡直到了無所不能的地步,誰說程式不能ReUser??
for word 叫 myword.dll
for excel叫 myexcel.dll
for ado呼叫excel叫myadoxls.dll
那常用的form就叫myfrmbox.dll
(*二個例子給您參考*)
function bxListBoxDialog(AppHandle:THandle;ACaption,SelectStr:pchar):pchar;
var LDialog:TListDialog;
modalresult : integer;
Selectedstr: string;
begin
result :='';
Application.Handle := AppHandle;
LDialog := TListDialog.Create(Application);
try
LDialog.ListBox1.Items.Text := StringReplace(trim(SelectStr),',',#13 #10,[rfReplaceAll]);
LDialog.Caption := ACaption;
modalresult :=LDialog.ShowModal;
if modalresult=mrOk then begin
Selectedstr := trim(LDialog.ListBox1.Items[LDialog.ListBox1.ItemIndex]);
result := pchar(string(Selectedstr));
end
finally
LDialog.Free;
end;
end;
procedure bxMemoDialog(AppHandle:THandle;ACaption,APrompt,CammStr:pchar);
var memobx: Tmemobx;
begin
Application.Handle := AppHandle;
memobx := Tmemobx.Create(Application);
try
memobx.Memo1.Lines.Text := trim(StringReplace(trim(CammStr),',',#13 #10,[rfReplaceAll]));
memobx.Caption := ACaption;
memobx.Label1.Caption:=APrompt;
memobx.ShowModal;
finally
memobx.Free;
end;
end;
------
努力會更接近成功
編輯記錄
pceyes 重新編輯於 2009-11-20 19:25:08, 註解 無‧
bill534
一般會員


發表:38
回覆:51
積分:17
註冊:2007-02-22

發送簡訊給我
#5 引用回覆 回覆 發表時間:2009-11-21 09:11:09 IP:114.41.xxx.xxx 訂閱
gs1_forms1,
gs1_p601 in 'gs1_p601.pas' {fmgs1_p601},
gs1_p1 in 'gs1_p1.pas' {fmgs1_p1},
gs1_p101 in 'gs1_p101.pas' {fmgs1_p101},
gs1_p102 in 'gs1_p102.pas' {fmgs1_p102},
gs1_p201 in 'gs1_p201.pas' {fmgs1_p201},
gs1_p406 in 'gs1_p406.pas' {fmgs1_p406},
gs1_p407 in 'gs1_p407.pas' {fmgs1_p407},
gs1_p501 in 'gs1_p501.pas' {fmgs1_p501},
gs1_p502 in 'gs1_p502.pas' {fmgs1_p502},
gs1_p503 in 'gs1_p503.pas' {fmgs1_p503},
gs1_p504 in 'gs1_p504.pas' {fmgs1_p504},
gs1_p506 in 'gs1_p506.pas' {fmgs1_p506},
gs1_p507 in 'gs1_p507.pas' {fmgs1_p507},
gs1_p508 in 'gs1_p508.pas' {fmgs1_p508},
gs1_p509 in 'gs1_p509.pas' {fmgs1_p509};
{$R *.res}
unit gs1_forms1;
interface
uses
SysUtils, Classes, Controls, forms, ExtCtrls,
gs1_p1,
gs1_p101, gs1_p102,
gs1_p201,
gs1_p406, gs1_p407,
gs1_p501, gs1_p502, gs1_p503, gs1_p504, gs1_p506, gs1_p507, gs1_p508, gs1_p509,
gs1_p601;
// Declare the export function of windows of the main DLL
procedure initApplication(AHandle: THandle);StdCall;
function gs1EmbeddedFormToPanel(pform: integer; ppanel: Tpanel): Pointer; Stdcall;
implementation
var
gs1Form1: TForm;
AppHandle: THandle;
procedure initApplication(AHandle: THandle);
begin
AppHandle := AHandle;
end;
if pform = 1 then
gs1Form1 := Tfmgs1_p1.Create(application)
else if pform = 101 then
gs1Form1 := Tfmgs1_p101.Create(application)
else if pform = 102 then
gs1Form1 := Tfmgs1_p102.Create(application)
else if pform = 103 then
begin
end
else if pform = 104 then
begin
end
else if pform = 105 then
begin
end
else if pform = 106 then
begin
end
else if pform = 107 then
begin
end
else if pform = 201 then
gs1Form1 := Tfmgs1_p201.Create(application)
else if pform = 406 then
gs1Form1 := Tfmgs1_p406.Create(application)
else if pform = 407 then
gs1Form1 := Tfmgs1_p407.Create(application)
else if pform = 501 then
gs1Form1 := Tfmgs1_p501.Create(application)
else if pform = 502 then
gs1Form1 := Tfmgs1_p502.Create(application)
else if pform = 503 then
gs1Form1 := Tfmgs1_p503.Create(application)
else if pform = 504 then
gs1Form1 := Tfmgs1_p504.Create(application)
else if pform = 506 then
gs1Form1 := Tfmgs1_p506.Create(application)
else if pform = 507 then
gs1Form1 := Tfmgs1_p507.Create(application)
else if pform = 508 then
gs1Form1 := Tfmgs1_p508.Create(application)
else if pform = 509 then
gs1Form1 := Tfmgs1_p509.Create(application)
else if pform = 601 then
gs1Form1 := Tfmgs1_p601.Create(application);

gs1Form1.Show;
gs1Form1.Visible := true;
result := gs1Form1;
end;

initialization
gs1Form1 := nil;
finalization
end.




系統時間:2024-05-16 13:35:02
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!