我在1024*768下编的程序要在800*600下运行,如何让它按照比例来进行缩小?还有:
我在状态栏里运用了Statusbar1.Panels[2].Text:=TimeToStr(Time);来显示时间,不过它显示出来之后就有能再变化了,我想让它按秒来增加变化的效果,如何实现?

解决方案 »

  1.   

    AutoSize设置为ture;
    (当然包阔form中的Panel也要设)
      

  2.   

    1.你可以使用timer控件里面写事件,将记录的分辨率与当前的分辨率比较.随后不同就改变窗体.
    2.在分辨率改变时通知你的程序改变窗体大小.不知道怎么做!
      

  3.   

    我在状态栏里运用了Statusbar1.Panels[2].Text:=TimeToStr(Time);来显示时间,不过它显示出来之后就有能再变化了,我想让它按秒来增加变化的效果,如何实现?使用timer,在ontimer中加入
    Statusbar1.Panels[2].Text:=TimeToStr(Time);
      

  4.   

    constructor TCommonForm.Create(AOwner: TComponent);
    var
        FWidth:integer;
    begin
      inherited;
        Font.Name := '宋体';
        Font.Size := 9;
        //分辨率问题
        if(Screen.width<> 800)then
        begin
        FWidth:=Width;
        Scaled:=TRUE;
        Font.Size:=(Width DIV FWidth)*Font.Size;//字体大小调整
        ScaleBy(Screen.Width,800); //控件大小调整
        Height:=longint(Height)*longint(Screen.Height)DIV 600;
        Width:=longint(Width)*longint(Screen.Width)DIV 800;//窗口大小调整
        end;
    end;
      

  5.   

    const
      currentwidth=1024;
      //currentheight=768;
    var 
       ratio:real;
    mainform.oncreate(sender:object);
    begin
        ratio:=screen.width/currentwidth;
        width:=width*(ratio*currentwidth);
        heigth:=height*(ratio*currentheight);
       mainform.ScaleBy(width,height) ;
    end;
    大概是这样,但愿没错!
      

  6.   

    加个TIMER控件,在事件中加入Statusbar1.Panels[2].Text:=TimeToStr(Time);
      

  7.   

    ---- 先 在 表 单 单 元 的Interface 部 分 定 义 两 个 常 量, 表 示 设 计 时 的 屏 幕 的 宽 度 和 高 度( 以 像 素 为 单 位)。 在 表 单 的Create 事 件 中 先 判 断 当 前 分 辨 率 是 否 与 设 计 分 辨 率 相 同, 如 果 不 同, 调 用 表 单 的SCALE 过 程 重 新 能 调 整 表 单 中 控 件 的 宽 度 和 高 度。 
    Const
        Orignwidth=800;
        Orignheight=600;procedure TForm1.FormCreate(Sender: TObject);
    begin
        scaled:=true;
        if (screen.width<>orignwidth) then
        begin
            height:=longint(height)*longint(screen.height) div orignheight;
            width:=longint(width)*longint(screen.width) div orignwidth;
            scaleby(screen.width , orignwidth);
        end;
    end;
      

  8.   

    当然放在窗体的Create事件中了,我给你的代码是通用窗体类中的一段,这样你可以继承它,你不用每个窗体都写相同的代码了;