如何让程序界面适应不同屏幕分辨率(0分)

  • 主题发起人 主题发起人 ey4e
  • 开始时间 开始时间
E

ey4e

Unregistered / Unconfirmed
GUEST, unregistred user!
请问如何让程序界面适应不同屏幕分辨率,比如在1200*768下开发得程序在800*600下有部分程序界面就看不到了,又不想用api函数直接变动屏幕分辨率,请问应该如何解决,谢谢。
 
procedure TfmZWPZtemplate.ScaleForm(CurForm: TForm);
const
Orignwidth=800;
Orignheight=600;
begin
with CurForm do begin
scaled := true;
if (screen.width <> orignwidth) or (screen.height <> Orignheight) then
begin
height := longint(height) * longint
(screen.height) div orignheight;
width := longint(width) * longint
(screen.width) div orignwidth;
scaleby(screen.width, orignwidth);
end;
end;
end;
 
对各个控件设置Anchors属性,能解决你的问题!
 
用这个(是800X600开发在1024中显示的):
type
TFooClass = class(TControl);
......................
..................
function tshwpic.trScreen(strdd : string):string;
var
devmode:tDevicemode;
orignwidth : integer;
orignheight,i : integer;
begin
orignwidth := 800; orignheight := 600;
swidth := screen.Width;
sheight := screen.Height;
scaled := true;
if (screen.width <> 800) then
begin
height := longint(height) * longint(screen.height) div 600;
width := longint(width) * longint(screen.width) div 800;
scaleBy(screen.width, 800);

for i := ControlCount - 1 downto 0 do
TFooClass(Controls).Font.Size :=
(screen.width div 800) *
TFooClass(Controls).Font.Size;
end;

end;
请问这方面有什么控件吗?
 
先保证在800*600下能正确显示,然后多有panel
 
后退
顶部