Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2007.06.24;
Скачать: CL | DM;

Вниз

problem with transparency   Найти похожие ветки 

 
Riton   (2006-11-04 17:04) [0]

Hello everybody,

I"d like to show text with a transparency effect on the desktop as below. It works good in delphi but not in kol. Why ? Is there a problem with the canvas ?

Indeed, a gray form is shown instead of my message "HELLO !". Can you resolve this problem please.

Thanks in advance.
Riton.

Here is the code :

unit Unit1;

interface

uses
 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,  ExtCtrls;

type
 TForm1 = class(TForm)
   procedure FormClose(Sender: TObject; var Action: TCloseAction);
   procedure FormCreate(Sender: TObject);
 private
   { Déclarations privées }
 public
   { Déclarations publiques }
 end;

var
 Form1: TForm1;
 HRgn,hr: THandle;
 s: String;

implementation

{$R *.DFM}

procedure ShowForm(f:Tform);
begin
   DeleteObject(HRgn);
   s:="HELLO !";
   BeginPath(f.Canvas.Handle);
   with f.Canvas do
   begin
         Font.Name := "times new roman"; Font.Size := 64; Font.Style := [fsBold];
         TextOut(1, 1, s);
   end;
   hr := createrectrgn(1,1,f.canvas.TextWidth(s),f.canvas.TextHeight(s));
   EndPath(f.Canvas.Handle);
   HRgn := PathToRegion(f.Canvas.Handle);
   combinergn(hrgn,hr,hrgn,rgn_diff);
   SetWindowRgn(f.Handle,hrgn, True);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
   DeleteObject(HRgn);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
   form1.BorderStyle:=Bsnone;
   form1.left:=10;
   form1.Top:=10;
   form1.Color:=$004203E7;
   ShowForm(form1);
end;

end.


 
Thaddy   (2006-11-06 16:01) [1]

Adapt this?


procedure TForm1.btnClick(sender:Pobj);
begin
 with NewCanvas(getDc(0))^ do //desktop handle = 0!
 try
    SetBkMode(handle, TRANSPARENT);
    Font.Color := clLime;
    Font.FontStyle := [fsBold];
    Font.FontName := "Arial";
    TextOut(40,40,"Drawing text on the desktop!");
 finally
    Free;
 end;
end;

The rest of your code should easily fit in this snippet.



Страницы: 1 вся ветка

Текущий архив: 2007.06.24;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.021 c
2-1180700653
ANB
2007-06-01 16:24
2007.06.24
Изменение CommandText у ClientDataSet


3-1175150328
fishka
2007-03-29 10:38
2007.06.24
Проблема с Excel


15-1180462678
TStas
2007-05-29 22:17
2007.06.24
Нужен скрипт пересылки на php


1-1177574403
intNaked
2007-04-26 12:00
2007.06.24
Компоненты: индикатор отклонения


1-1177338712
webpauk
2007-04-23 18:31
2007.06.24
Проблема с положением объектов в ScrollBoxe