function AUTOAdapt(Tfm:TWinControl{容器};wint1,hint1:Integer{开发时的分辨率};DeftB:Boolean=false{容器是否也调整}):Boolean;
var
i,j:Integer;
vl_ScreenWidth,vl_ScreenHeight: LongInt;
WRadio,HRadio : double ;
temp:TControl;
begin
try
result:=false;
vl_ScreenWidth := Screen.Width;
vl_ScreenHeight := screen.height;
WRadio := vl_ScreenWidth/wint1 ;
HRadio := vl_ScreenHeight/hint1 ;
if (WRadio=1) and (HRadio=1 ) then
begin
Result:=True; Exit;
end;
if DeftB=true then
with Tfm do
begin
Width:=Round(width*WRadio);
Height:=Round(Height*HRadio);
left:=Round(left*WRadio);
top:=Round(top*HRadio);
end;for i:=0 to (Tfm.ControlCount)-1 do
begin
temp:=Tfm.Controls[i];
with temp do
begin
Width:=Round(width*WRadio);
Height:=Round(Height*HRadio);
left:=Round(left*WRadio);
top:=Round(top*HRadio);
end;
try
if UpperCase(temp.ClassName)='TTOOLBAR' then
with (temp as TTOOLBAR) do
begin
buttonWidth:=Round(buttonwidth*WRadio);
buttonHeight:=Round(buttonHeight*HRadio);
end
else
if (temp as TWinControl).ControlCount>0 then //如果是容器就 递归调用
AUTOAdapt(temp as TWinControl,wint1,hint1,false);
except
Exit;
end;
end;
result:=True;
except
Result:=False;
end;
end;此函数有什么 缺陷??
怎么样才能达到目的
var
i,j:Integer;
vl_ScreenWidth,vl_ScreenHeight: LongInt;
WRadio,HRadio : double ;
temp:TControl;
begin
try
result:=false;
vl_ScreenWidth := Screen.Width;
vl_ScreenHeight := screen.height;
WRadio := vl_ScreenWidth/wint1 ;
HRadio := vl_ScreenHeight/hint1 ;
if (WRadio=1) and (HRadio=1 ) then
begin
Result:=True; Exit;
end;
if DeftB=true then
with Tfm do
begin
Width:=Round(width*WRadio);
Height:=Round(Height*HRadio);
left:=Round(left*WRadio);
top:=Round(top*HRadio);
end;for i:=0 to (Tfm.ControlCount)-1 do
begin
temp:=Tfm.Controls[i];
with temp do
begin
Width:=Round(width*WRadio);
Height:=Round(Height*HRadio);
left:=Round(left*WRadio);
top:=Round(top*HRadio);
end;
try
if UpperCase(temp.ClassName)='TTOOLBAR' then
with (temp as TTOOLBAR) do
begin
buttonWidth:=Round(buttonwidth*WRadio);
buttonHeight:=Round(buttonHeight*HRadio);
end
else
if (temp as TWinControl).ControlCount>0 then //如果是容器就 递归调用
AUTOAdapt(temp as TWinControl,wint1,hint1,false);
except
Exit;
end;
end;
result:=True;
except
Result:=False;
end;
end;此函数有什么 缺陷??
怎么样才能达到目的
解决方案 »
- 关于修改其他程序dll子窗口中的label问题。
- 请问WebService怎会传出整个程式码(WebService本体)?(Delphi 2009)
- 非常着急!!搜了很多帖子,关于dbgrid的onDrawColumnCell事件的一个问题还是没能解决!
- Delphi7中的dbExpress连接DB2怎不能ApplyUpdates???没有分了,有分以后再加50分。
- Rave在Execute之后怎么出来一个英文的界面啊?怎么办?
- vb转化为delphi
- 高手请进,idirc在activeform,onmessage事件等都收不到了.?
- Interbase有没有free的odbc driver
- select中的like 该怎么写
- 用delphi怎样做一个relaese版本的程序??
- 如何用Random在FORM中随机显示图片
- 如何知道窗体上的哪个控件获得焦点?
如果只是作为容器范围太大
也不可以啊~~.temp:TControl; 是因为Tfm.Controls[i] 就只能是 TControl类型的