Controls 'TreeView1' has no 找进销存软件破解版
财务软件版1楼: 在Dll中一个窗体,窗体中放了一个TreeView1。在主程序中调用了这个窗体,并将其dock到主程序中的一个PageControls中。
问题是:当在TreeView1中点击鼠标右键时会出现''control ''treeview1'' has no parent window.''错误提示。
请教高手如何解决?谢谢!
Result := Frm_Library;
end;
procedure DLLExit(Reason: Integer);
begin
if Reason = DLL_PROCESS_DETACH then
begin
Application := DLLApp;
Screen := DLLScr;
end;
end;
exports
NewDLLForm;
begin
DllApp := Application;
DllScr := Screen;
DLLProc := @DLLExit;
end.
主程序:
(dll中exports的方法已静态导入。f为TForm类型的全局变量)
procedure TForm1.Button4Click(Sender: TObject);
begin
f := importDll.NewDLLForm(Application, Screen, self.PageControl1);
f.ParentWindow := self.PageControl1.Handle;
f.Parent := self.PageControl1;
f.ManualDock(self.PageControl1, self.PageControl1.ActivePage, alClient);
f.Show;
end;
基本代码就是这样,当右击dll窗体中的Treeview1时就会出现control ''Treeview1'' has no parent window.错误提示。
楼主带包编译
Project-》packages-》Build with runtime packages 打勾
问题是:当在TreeView1中点击鼠标右键时会出现''control ''treeview1'' has no parent window.''错误提示。
请教高手如何解决?谢谢!
2楼: 估计你要设置一下TreeView1的Parent属性。 如进销存软件破解版
3楼: treeview1.parent:=父窗口对象实例
4楼: dll中exprots function NewDLLForm(App: TApplication; Scr: TScreen): TForm;
在主程序中调用此方法生成一个窗体后,将其dock到主程序的Pagecontrol1上。此时再右击dll窗体的TreeView1时就出现了control ''Treeview1'' has no parent window错误提示。为什么?
5楼: 你把代码贴一贴。
6楼: DLL代码:
...
var
DllApp: TApplication;
DllScr: TScreen;
function NewDLLForm(App: TApplication; Scr: TScreen): TForm;
begin
Application := App;
Screen := Scr;
Application.CreateForm(TFrm_Library, Frm_Library);//Frm_Library窗体中在设计时放置了一个TreeView1。
Result := Frm_Library;
end;
procedure DLLExit(Reason: Integer);
begin
if Reason = DLL_PROCESS_DETACH then
begin
Application := DLLApp;
Screen := DLLScr;
end;
end;
exports
NewDLLForm;
begin
DllApp := Application;
DllScr := Screen;
DLLProc := @DLLExit;
end.
主程序:
(dll中exports的方法已静态导入。f为TForm类型的全局变量)
procedure TForm1.Button4Click(Sender: TObject);
begin
f := importDll.NewDLLForm(Application, Screen, self.PageControl1);
f.ParentWindow := self.PageControl1.Handle;
f.Parent := self.PageControl1;
f.ManualDock(self.PageControl1, self.PageControl1.ActivePage, alClient);
f.Show;
end;
基本代码就是这样,当右击dll窗体中的Treeview1时就会出现control ''Treeview1'' has no parent window.错误提示。
财务软件版7楼: to Demogodyou
你的工程有没有带包编译。如果不是带包编译,劝你还是带包编译。要不问题太多。
8楼: 目前的水平就到这里,还在学习中。是否有简单的解决方法?谢谢
9楼: 替楼上的楼上解释下
楼主带包编译
Project-》packages-》Build with runtime packages 打勾
10楼: 接受答案了.