请教如何在IMAGE显示的图象上显示透明滚动的字母。

解决方案 »

  1.   

    在TImage上动态画会出现闪烁,改为直接画到canvas上吧
    unit Unit3;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;type
      TForm1 = class(TForm)
        Image1: TImage;
        Timer1: TTimer;
        procedure FormCreate(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
        function SetLCDRGN(aRECT: TRECT): HRGN;
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      RGN: HRGN;
      PosX, PosY: Integer;
    implementation{$R *.dfm}function TForm1.SetLCDRGN(aRECT: TRECT): HRGN;
    var
      rTemp, r: HRGN;
      x, y: integer;
    begin
      Result := CreateRectRgn(0, 0, 0, 0);
      for y := aRECT.Top to aRECT.Bottom do
        if (y mod 4) = 0 then
          for x := aRECT.Left to aRECT.Right do
          begin
            if (x mod 4) = 0 then
            begin
              rTemp := CreateRectRgn(x, y, x + 3, y + 3);
              CombineRgn(Result, Result, rTemp, RGN_OR);
    //          CombineRgn(r, r, rTemp, RGN_XOR);
            end;
          end;
      DeleteObject(rTemp);end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      RGN := SetLCDRGN(RECT(10, 10, 600, 200));
      PosX := 600;
      PosY := 10;
      Show;
      SelectClipRgn(Canvas.Handle, RGN);
      Canvas.FillRect(RECT(10, 10, 600, 200));
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      SelectClipRgn(Canvas.Handle, RGN);
      PosX := PosX - 4;
      if PosX < 10 - Image1.Picture.Width then
        PosX := 600;  Canvas.Draw(PosX, PosY, Image1.Picture.Graphic);end;end.
    -------------------------------------------------------
    本回复由大傻的破玩意儿【CSDN's forum Explorer】完成!
    软件功能强大,速度超快!!支持中...
    软件下载地址:http://CoolSlob.ys168.com
      

  2.   

    /to xzhifei
    你转載的方法虽然可行,不过如果我的字体的边上有半透明的像素,
    請问你怎么弄这个半透明的
      

  3.   


    我的建议还是图像32位叠加,至于抗闪烁,弄一个缓冲区Bitmap,把所以移动的图,字,都32位叠加到缓冲区,最后再一次性复制显示