如何按不同的分辨率始终满屏的显示文字!
要求居中,宽为屏幕的百分之八十!
谢谢!

解决方案 »

  1.   

    你的问题的解决方法:我是用了screen.width为取得宽度的,所以与你的显示器无关
    而在计算高度的时候,我用了一个小技巧的
    把MEMO每一行的长度除以当前屏幕宽度
    这样就可以得到LABEL自动换行后的行数,再把行数 * 字高
    你在改成80%的时候,要注意把那个计数行数的被除数一起改成80%,也就是说被除数一定要是LABEL的宽度procedure TForm1.Button2Click(Sender: TObject);
    var
      i:integer;
      txtHeight:integer;
    begin
    memo1.Lines.LoadFromFile('1.txt');
     if edit1.Text<>'' then
     timer1.Interval:=strtoint(edit1.Text);
     if memo1.Lines.Text<>'' then
     begin
        txtHeight:=memo1.Lines.Count;
        for i:=0 to memo1.Lines.Count do
        begin
          txtHeight:=txtHeight+ Trunc((label1.Canvas.TextWidth(memo1.Lines[i]))/screen.Width);
        end;   label1.Caption:=memo1.Lines.Text;
       label1.Height:=txtHeight * label1.Canvas.TextHeight('我');
       label1.Left:=0;
       label1.width:=screen.Width;
     end;
     if edit3.Text<>'' then
      form1.Color:=TColor(strtoint('$'+edit3.Text));
     if edit4.Text<>'' then
      label1.Font.Color:=TColor(strtoint('$'+edit4.Text));
    end;