const
  ScreenWidth: LongInt = 800; 
  ScreenHeight: LongInt = 600;var
FWidth:integer;
begin
//适应分辨率的变化
   if (screen.width <> ScreenWidth) then
  begin
    FWidth:=Width;
    scaled := true;
    Font.Size:=(screen.Width DIV screenWidth)*Font.Size;
   scaleBy(screen.width, ScreenWidth);
    height := longint(height) * longint(screen.height) div ScreenHeight;
    width := longint(width) * longint(screen.width) div ScreenWidth;  end;
问题:当窗体的borderstyle属性 为bsSizeable是可以实现按比例放大,当窗体的borderstyle属性其余的属性时,运行的结果是窗体全屏显示!!!
请各位帮忙分析一下!!

解决方案 »

  1.   

    var
      ScreenHeight,ScreenWidth:Longint;
    begin
      scaled := true;
      ScreenHeight:=600;
      ScreenWidth:=800;
      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;
      

  2.   

    你是在那个事件中调用的这段代码?如果是在form的create中调用的,可能无论你把borderstyle设置成什么属性都可以,如果你实在formshow中调用的可能就只有bsSizeable可以。有一个方法就是,可以在这段代码前把form德boderstyle先保存下来,改成bsSizeabloe,在改回去。
    var OldBorderStyle : TBorderStyle;
    OldBorderStyle:=Form1.BorderStyle;
    Form1.BorderStyle:=bsSizeable;
    ...
    Form1.BorderStyle:=OldBorderStyle;
      

  3.   

    我是在formcreate中调用的!是不是和分辨率有些关系阿!
    800*600调到1024*768可以。调到1280*1024时,就全屏了!明天我试试楼上的方法!多谢各位!!