各位大哥:
问题1:我的应用程序是在17寸的显示屏1024*768分辨率下开发的,程序现在要拿到其他的笔记本上 去运行,他们的屏幕和分辨率不相同,有的是14寸800*600分辨率,有的是15寸1024*768分辨 率,也有15寸800*600分辨率的,我怎么让我的程序界面去适应他们的屏幕大小和分辨率大小呀?(要求对程序所有的界面转化)
问题2:如何让全屏后我的程序界面随全屏后按比例缩放呀!老是全屏后界面空着很多或是变形?
问题1:我的应用程序是在17寸的显示屏1024*768分辨率下开发的,程序现在要拿到其他的笔记本上 去运行,他们的屏幕和分辨率不相同,有的是14寸800*600分辨率,有的是15寸1024*768分辨 率,也有15寸800*600分辨率的,我怎么让我的程序界面去适应他们的屏幕大小和分辨率大小呀?(要求对程序所有的界面转化)
问题2:如何让全屏后我的程序界面随全屏后按比例缩放呀!老是全屏后界面空着很多或是变形?
2,一般组件的autosize设置为fasle,或者是 ALIGN 设置为alclient
我在程序里面用一个按钮怎么动态实现我的数据库连接的转换,比如我有两个Adoconnection
一个本地为LocalAdoconnetion,一个为远程RemoteAdoconnection,我的Adoquery要和Adoconnection连接!怎么动态实现改变数据库连接?
里面都是关于PB的解决方法呀,没有Delphi的!还请大哥们赐教呀!
俺以前试过了!
后来干脆分别设计窗体,调用相同的代码
最后根据情况分别调用编译后的不同程序
就行了呗!
要是觉得 界面放大后不好看,就别最大化了下面是个给你转贴个
implementation
const
ScreenWidth: LongInt = 800; {I designed my form in 800x600 mode.}
ScreenHeight: LongInt = 600;{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
begin
scaled := true;
if (screen.width <> ScreenWidth) then begin
height := longint(height) * longint(screen.height) DIV ScreenHeight;
width := longint(width) * longint(screen.width) DIV ScreenWidth;
scaleBy(screen.width, ScreenWidth);
end;
end;下面是解决字体大小的代码:
USES typinfo; {Add this to your USES statement.}var
i: integer;
begin
for i := componentCount - 1 downto 0 do
with components[i] do
begin
if GetPropInfo(ClassInfo, 'font') <> nil then
font.size := (NewFormWidth DIV OldFormWidth) * font.size;
end;
end;下面的函数可以解决问题:
Form:需要调整的Form,OrgWidth:开发时屏幕的宽度,OrgHeight:开发时屏幕的高度。
注意:需要把Form的Scaled设置为True。
procedure AdjustForm(Form: TForm; const OrgWidth, OrgHeight: integer);
begin
with Form do
begin
Width := Width * Screen.Width div OrgWidth;
Height := Height * Screen.Height div OrgHeight;
ScaleBy(Screen.Width, OrgWidth);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
AdjustForm(Self,1280,1024);
end;