请问dll窗体融合进主窗体后,里面控件的滚动条都木有了,高手们是怎么处理这个问题的? 如题dll窗体融合到主窗体里面的pagecontrol里面。但是dll窗体里面dbgrid和stringgrid的滚动条都木有了,请问高手们是怎么处理这个问题的。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用着目前没发现什么问题,就是数据表格没有滚动条很头大~~原来好像看过有人说用scrollbox,但现在找不到了~~附部分代码:dll窗体创建函数function InputTask(Apphnd: THandle;cLocal,cRemote: TADOConnection; isNet: Boolean;pUser: PChar): TForm;begin Application.Handle := Apphnd; Result := TInputTaskWnd.Create(nil); with TInputTaskWnd(Result) do begin lConn := cLocal; rConn := cRemote; isRemoteDB := isNet; sCurUser := StrPas(pUser); InitDataSource; end;end;主程序调用: DllHnd := LoadLibrary(PChar(sDllFile)); if DllHnd > 0 then begin pOperWnd := GetProcAddress(DllHnd,PChar(ProcName)); if Assigned(pOperWnd) then begin frmChild := pOperWnd(Handle,DM.LocalADOC,DM.RemoteADOC, isRemoteDB,PChar(sCurUser)); CreateChildWnd(frmChild,sTitle); lstOpenedWnd.Add(IntToStr(iTag)); frmChild.SetFocus; end; end;procedure TMainWnd.CreateChildWnd(pExec: TForm;sTitle: string);var tabSheet: TTabSheet;begin Inc(ChildFormCount); SetLength(ChildFormArr,ChildFormCount); ChildFormArr[ChildFormCount - 1] := pExec; tabSheet := TTabSheet.Create(nil); tabSheet.PageControl := PageControl1; tabSheet.Caption := sTitle; PageControl1.ActivePageIndex := ChildFormCount - 1; ChildFormArr[ChildFormCount - 1].ParentWindow := tabSheet.Handle; ChildFormArr[ChildFormCount - 1].Align := alClient; ChildFormArr[ChildFormCount - 1].Icon.Handle := Application.Icon.Handle; ChildFormArr[ChildFormCount - 1].Show;end; 不仅仅是DLL窗体融合到pagecontrol会发生这种现象,BPL方式的窗体融合也会发生这种现象,而且不仅是标准控件,cxgrid也会有这种现象,但这种现象也不是在所有的PC上都会发生,我发现过在我的本本上发生这种现象时,其他PC机上运行相同的程序,却没有发生这种现象。切换一下pageControl的TABSHEET,再回到当前的TabSheet时,滚动条又会出现了。,目前我也没有找到真正的原因。 调用dll的窗体,问题确实很多。 stinggrid是标准控件,表格是用的grideh 你说的滚动条没有了,鼠标中键滚动有效果没?你说的这问题还真没遇到过,我感觉是不是其他的影响了,你可以试试用个空的窗体上面放个pagecontrol其他的都不要,然后加载dll看看。 鼠标中键效果还有。dll窗体如果不融合,showmodal出来滚动条就有。如果不用dll,在一个exe内窗口融合也是木有问题的~~ 我说的意思是流程不变,只是用个空的窗体(不要其他任何控件只有一个pagecontrol)来加载dll融合里面的窗体到pagecontrol上是不是也会出问题。其次我见你的函数参数中有个apphnd你用来保存application的句柄,但在函数中创建窗体的时候确实用的nil。 我也弄过这种page加载DLL的框架,但我表示我有的滚动条。还有我里面显示数据用的都是listview动态加载DLL的 找了下找到了用的是RZ牌pagecontrol Page := TRzTabSheet.Create(PageControl1); Page.Caption := str; Page.PageControl := PageControl1; Page.Show; hInstance := LoadLibrary(PChar(Cache.Strings[IndexStr] + '.dll')); //载入DLL pFunction := GetProcAddress(hInstance, PChar(StrHint)); //调用接口 pFunction; han := FindWindow(nil, PChar(str)); Windows.SetParent(han, Page.Handle); pixW := GetDeviceCaps(Canvas.Handle, HORZRES)-170 ; pixH := GetDeviceCaps(Canvas.Handle, VERTRES) -180 ; Windows.MoveWindow(han, 0, 0, pixW, pixH - 16, true);以上代码加载的 谢谢楼上,难道是pagecontrol的问题,我换panel试试看看;另外,你用的RZ是哪个版本的? 试了试,问题也不是出在pagecontrol,如果表格的align设置成none,滚动条就有,我程序中设置成alclient,滚动条就没有了。还是谢谢大家。 初步解决方法,表格align属性设置为alnone在主窗体大小改变的时候,给子窗体发消息,消息参数中带上tabSheet的宽度,子窗体收到消息后调整根据参数调整表格的宽度。 Mark感谢分享,目前还没遇到过 LZ试过添加parent么?仔细看14L的代码比你多了这句话哦Windows.SetParent(han, Page.Handle); 试了,panel也一样。Windows.SetParent(han, Page.Handle);ChildFormArr[ChildFormCount - 1].ParentWindow := tabSheet.Handle;一样的。 可能是没有设置好DLL窗体的宽高吧 dephi打包发布时,bde怎么打包进去 SQLCONNECTION 连接数据库问题 求游戏编程的资料 请问在DELPHI中用ADO怎样连接Excel? 100分请教: 对二进制位的操作(如VFP中的 bitand, bitor, bitrshift). 关于ListView的问题 同志们,有个公司想买我的电子词典程序,你们说我该出多少价? 怎么样把HTML网页上的内容直接输出到WORD 如何处理Listview选中Checkbox的消息? 在线等. 自己写程序编译Delphi源程序!!! delphi中的image中的图片问题!! 新做的IPhone界面导航
function InputTask(Apphnd: THandle;cLocal,cRemote: TADOConnection;
isNet: Boolean;pUser: PChar): TForm;
begin
Application.Handle := Apphnd;
Result := TInputTaskWnd.Create(nil);
with TInputTaskWnd(Result) do
begin
lConn := cLocal; rConn := cRemote;
isRemoteDB := isNet;
sCurUser := StrPas(pUser);
InitDataSource;
end;
end;主程序调用:
DllHnd := LoadLibrary(PChar(sDllFile));
if DllHnd > 0 then
begin
pOperWnd := GetProcAddress(DllHnd,PChar(ProcName));
if Assigned(pOperWnd) then
begin
frmChild := pOperWnd(Handle,DM.LocalADOC,DM.RemoteADOC,
isRemoteDB,PChar(sCurUser));
CreateChildWnd(frmChild,sTitle);
lstOpenedWnd.Add(IntToStr(iTag));
frmChild.SetFocus;
end;
end;procedure TMainWnd.CreateChildWnd(pExec: TForm;sTitle: string);
var tabSheet: TTabSheet;
begin
Inc(ChildFormCount);
SetLength(ChildFormArr,ChildFormCount);
ChildFormArr[ChildFormCount - 1] := pExec;
tabSheet := TTabSheet.Create(nil);
tabSheet.PageControl := PageControl1;
tabSheet.Caption := sTitle;
PageControl1.ActivePageIndex := ChildFormCount - 1;
ChildFormArr[ChildFormCount - 1].ParentWindow := tabSheet.Handle;
ChildFormArr[ChildFormCount - 1].Align := alClient;
ChildFormArr[ChildFormCount - 1].Icon.Handle := Application.Icon.Handle;
ChildFormArr[ChildFormCount - 1].Show;
end;
你说的这问题还真没遇到过,我感觉是不是其他的影响了,你可以试试用个空的窗体上面放个pagecontrol其他的都不要,然后加载dll看看。
dll窗体如果不融合,showmodal出来滚动条就有。
如果不用dll,在一个exe内窗口融合也是木有问题的~~
其次我见你的函数参数中有个apphnd你用来保存application的句柄,但在函数中创建窗体的时候确实用的nil。
还有我里面显示数据用的都是listview
动态加载DLL的
找了下找到了
用的是RZ牌pagecontrol
Page := TRzTabSheet.Create(PageControl1);
Page.Caption := str;
Page.PageControl := PageControl1;
Page.Show;
hInstance := LoadLibrary(PChar(Cache.Strings[IndexStr] + '.dll')); //载入DLL
pFunction := GetProcAddress(hInstance, PChar(StrHint)); //调用接口
pFunction;
han := FindWindow(nil, PChar(str));
Windows.SetParent(han, Page.Handle);
pixW := GetDeviceCaps(Canvas.Handle, HORZRES)-170 ;
pixH := GetDeviceCaps(Canvas.Handle, VERTRES) -180 ;
Windows.MoveWindow(han, 0, 0, pixW, pixH - 16, true);
以上代码加载的
另外,你用的RZ是哪个版本的?
在主窗体大小改变的时候,给子窗体发消息,消息参数中带上tabSheet的宽度,子窗体收到消息后调整根据参数调整表格的宽度。
感谢分享,目前还没遇到过
仔细看14L的代码比你多了这句话哦
Windows.SetParent(han, Page.Handle);
ChildFormArr[ChildFormCount - 1].ParentWindow := tabSheet.Handle;
一样的。