Цитата:
Сообщение от Prof-x
Пишу на BDS 2006 без .net.
На GDI, браш поставил.
Форма прозрачная белая.
Ни чего не изменилось.
вот код
Код:
procedure TForm1.FormCreate(Sender: TObject);
begin
txt := 'Я люблю DELPHI)))';
BitMap := TBitmap.Create;
Bitmap.Width := Form1.Width;
Bitmap.Height := form1.Height;
Bitmap.Height := 100;
Bitmap.Canvas.Brush.Color := clwhite;
Bitmap.Canvas.Font.Name := 'Trebuchet MS';
Bitmap.Canvas.Font.Size := 35;
Bitmap.Canvas.Font.Color := clGreen;
//bitmap.TransparentColor:=clwhite;
bitmap.Transparent:=true;
TW := 100;
X := Form1.Width;
{if form1.BorderStyle = bsSizeable then
Y := (form1.Height) div 2 - (bitmap.Canvas.Font.Size)div 2 - 100;}
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
i := 2;
Bitmap.Width := Form1.Width;
Bitmap.Height := Form1.Height;
Bitmap.Canvas.Polygon([Point(0, 0), Point(1280, 0),
Point(1280, 767), Point(0, 767)]);
X := X - i;
if X <= (-TW * (font.Size div 2))
then X := Form1.Width;
Canvas.Brush.Style := bsClear;
Bitmap.Canvas.TextOut(X,Y,txt);
Form1.Canvas.Draw(0,0,Bitmap);
if form1.WindowState = wsMaximized
then Y := (form1.Height) div 2 - (bitmap.Canvas.Font.Size);
if form1.WindowState = wsNormal
then Y := (form1.Height) div 2 - (bitmap.Canvas.Font.Size) div 2 - 35;
end;
|
в этом случае при создание буфера (bitmap) устаналивай глубину цвета на 32 бита, Bitmap.PixelFormat := pf32bit (честно не помню название, но примерно так), потому как битмап по умолчанию создаётся с 24 битами на пиксель.