Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

timage (bitmap) ghost it?

Status
Not open for further replies.

jbpelletier

Programmer
Sep 8, 2001
232
CA
Hi,

how can i do this,
using a Timage that contain a .bmp file

i whant to make the timage containt to be lighter,like adding white color,

also if possible i would like to make it look half translucide , prolly adding the same color as the form is, instead of addind white.. or maybe both at a time..

i guess u figure what i whant to do, i dont know if im in the right path
also i whant to avoid to have to loop into the bitmap to do that thing

any help apreciate
tnx
jb
 
i found this, and it could help me... if i change the handle to make my timage translucide.

my problem is that im using delphi 5 and the uses "variants" come with delphi 6 i think...

if i had the d6 variants uses to my d5 rep will it work?
if yes where i can DL it?
or do variants uses is "present" under an other name in d5?

tnax jb

unit Unit1;

interface

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

type
TForm1 = class(TForm)
Timer1: TTimer;
procedure setTransparencyPercentage(_HWnd:cardinal; _Value:byte);
procedure FormShow(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Déclarations privées }

public
{ Déclarations publiques }
end;

var
Form1: TForm1;
iShade : byte;

implementation

{$R *.dfm}

Procedure TForm1.setTransparencyPercentage(_HWnd:cardinal; _Value:byte);
{Paramètres entrant
_HWnd : descripteur de fenêtre
_Value : pourcentage de transparence}
var
Attrib:integer;
begin
if _Value>100 then _Value:=100;
//Définit la valeur d'opacité (de 0 à 255)
_Value:=255-Trunc((255*_Value)/100);
Attrib:=getWindowLong(_HWnd, GWL_EXSTYLE);
SetWindowLong( _HWnd,GWL_EXSTYLE, Attrib or WS_EX_LAYERED);
SetLayeredWindowAttributes(_HWnd,0,_Value,LWA_ALPHA);
end;

procedure TForm1.FormShow(Sender: TObject);
begin
setTransparencyPercentage(Handle,100);
iShade := 100;
Timer1.Enabled := true;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if (iShade) <= 0 then
begin
Timer1.Enabled := false;
Exit;
end;
iShade := iShade - 4;
setTransparencyPercentage(Handle,iShade);
application.ProcessMessages;
end;

end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top