Un composant pour le rendre transparent (en forme de) formes


Le code ci-dessous est un composant pour créer transparent (en forme), les formulaires ...
Le code ci-dessous est un composant pour créer transparent (en forme) des formulaires en utilisant soit des bitmaps ou de contrôle, ou les deux. Il y a deux façons de raconter le composant que vous voulez utiliser comme un masque: la Balise de réglage (TransTag) ou d'un Composant de la liste où vous suffit d'insérer le nom du composant comme une nouvelle ligne de texte.
Il y a même un événement à suivre l'état d'avancement du processus, quand c'est long.
Pour les images, il s'agit d'un Masque de Couleur de la propriété, qui est la couleur qui sera transparent.
Utiliser la méthode Execute pour faire de la transparence de la forme. Quand il n'y a pas beaucoup d'images, le processus est très rapide et vous pouvez l'utiliser pour créer des effets d'animation sur votre bureau.
NOTE: pour la création du Masque à partir d'images le composant prend en compte le composant TImage.
unité de TransMake
interface

& nbsp & nbsp Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,ExtCtrls
type
& nbsp & nbsp TProcessEvent=procédure(progrès:longint) de l'objet
& nbsp & nbsp Par l' =(TBTag,TBComponentList)
& nbsp & nbsp TTransMake = class(TComponent)
& nbsp & nbsp privé
& ! & ! & ! & nbsp { Private declarations }
& ! & ! & ! & nbsp ITransTag:integer
& ! & ! & ! & nbsp ImageTrans:Boolean
& ! & ! & ! & nbsp ColorMask:TColor
& ! & ! & ! & nbsp région:hrgn
& ! & ! & ! & nbsp TransByV:Par l'
& ! & ! & ! & nbsp ComponentListV:TStrings
& ! & ! & ! & nbsp fullitems:LongInt
& ! & ! & ! & nbsp FOnProgress:TProcessEvent
& ! & ! & ! & nbsp procédure DrawTransparent
& ! & ! & ! & nbsp procédure ComponentListWrite(valeur:TStrings)
& ! & ! & ! & nbsp procédure SetTransBy(valeur:Par l')
& nbsp & nbsp protégé
& ! & ! & ! & nbsp { déclarations Protégées }
& ! & ! & ! & nbsp procédure DoOnProgress(progrès:longint) dynamique
& nbsp & nbsp public
& ! & ! & ! & nbsp { Publc déclarations }
& ! & ! & ! & nbsp Procédure d'Exécution
& ! & ! & ! & nbsp Constructor Create(AOwner:TComponent) remplacer
& nbsp & nbsp publié
& ! & ! & ! & nbsp { Publié des déclarations }
& ! & ! & ! & nbsp Propriété TransTag:Integer lire ITransTag écrire ITransTag
& ! & ! & ! & nbsp Propriété ImageRegion:boolean lire ImageTrans écrire ImageTrans
& ! & ! & ! & nbsp propriété MaskColor:TColor lire ColorMask écrire ColorMask
& ! & ! & ! & nbsp propriété TransBy:Par lire TransByV écrire SetTransBy par défaut TBTag
& ! & ! & ! & nbsp propriété ComponentList:TStrings lire ComponentListV écrire ComponentListWrite
& ! & ! & ! & nbsp propriété OnProgress:TProcessEvent lire FOnProgress écrire FOnProgress
& nbsp & nbsp fin
procédure Register
application
procédure TTransMake.DoOnProgress(progrès:longint)
begin
& nbsp & nbsp si affecté(FonProgress)
& ! & ! & ! & nbsp TProcessEvent(FonProgress)(cours)
fin
procédure TTransMake.SetTransBy(Valeur:Par l')
begin
& nbsp & nbsp TransByV := Valeur
fin
procédure TTransMake.ComponentListWrite(Valeur:TStrings)
begin
& nbsp & nbsp ComponentListV.Attribuer(valeur)
fin
constructeur TTransMake.Create(AOwner:TComponent)
begin
& nbsp & nbsp hérité Create(AOwner)
& nbsp & nbsp ComponentListV:=TStringList.Créer
& nbsp & nbsp ComponentListV.Add('Endroit de votre composant les noms ici.')
& nbsp & nbsp FullItems:=0
fin
procédure TTransMake.DrawTransparent
var
& nbsp & nbsp OForm:TForm
& ! & ! & ! & nbsp i,o,x,y,rx,ry:integer
& ! & ! & ! & nbsp tr:Trect
& ! & ! & ! & nbsp tregion,imgregion:Hrgn
& ! & ! & ! & nbsp procéder:boolean
& nbsp & nbsp TempBitmap: TBitmap
& nbsp & nbsp Rgn1, Rgn2: HRgn
& nbsp & nbsp Col, Début, Ligne,test: integer
& nbsp & nbsp Ligne: PByteArray
& nbsp & nbsp faisant,perc:integer
begin
& nbsp & nbsp OForm:=TForm(owner)
& nbsp & nbsp région:=0
& nbsp & nbsp imgregion:=0
& nbsp & nbsp rgn1:=0
& nbsp & nbsp fullitems:=0
& nbsp & nbsp:=0
& nbsp & nbsp perc:=0
& nbsp & nbsp région:=createRectRgn(0,0,0,0)
& nbsp & nbsp rgn1:=createRectRgn(0,0,0,0)
& nbsp & nbsp OForm.visible:=false
& nbsp & nbsp OForm.BorderStyle:=bsNone
& nbsp & nbsp for i:=0 to OForm.ComponentCount-1 do
& ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & nbsp si TransBy=TBTag puis
& ! & ! & ! & ! & ! & ! & ! & nbsp si (OForm.Composants[i]).tag=TransTag puis
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp procéder:=true
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fullitems:=fullitems 1
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & nbsp si TransBy=TBComponentList puis
& ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si componentlistV.Count>0 then
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp pour o:=0 pour componentlistv.Count-1 do
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si (en Majuscules((OForm.Composants[i]).nom)=majuscule(componentlistv.Cordes[o]))
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fullitems:=fullitems 1
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & nbsp fin
& nbsp & nbsp for i:=0 to OForm.ComponentCount-1 do
& ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & nbsp procéder:=false
& ! & ! & ! & ! & ! & nbsp si TransBy=TBTag puis
& ! & ! & ! & ! & ! & ! & ! & nbsp si (OForm.Composants[i]).tag=TransTag puis
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp procéder:=true
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & nbsp si TransBy=TBComponentList puis
& ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si componentlistV.Count>0 then
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp pour o:=0 pour componentlistv.Count-1 do
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si (en Majuscules((OForm.Composants[i]).nom)=majuscule(componentlistv.Cordes[o]))
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp pro eed:=true
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & nbsp si procédez ensuite

& ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si TControl(OForm.composants[i]).visible
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si (OForm.composants[i] est TImage) et ImageRegion puis
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp avec TImage(OForm.composants[i]).image.image bitmap n'
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp pour la Ligne := 0 à TImage(OForm.composants[i]).image.bitmap.hauteur-1 do
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp Col := 0
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tandis que Col < TImage(OForm.composants[i]).image.bitmap.La largeur ne
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp & nbsp while (Col < TImage(OForm.composants[i]).image.bitmap.La largeur) et (Toile.pixels[col,row] = ColorMask) ne inc(Col)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si le Col >= TImage(OForm.composants[i]).image.bitmap.Largeur puis Continuer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp Début := Col
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp while (Col < TImage(OForm.composants[i]).image.bitmap.La largeur) et (Toile.pixels[col,row] <> ColorMask) ne inc(Col)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si le Col >= TImage(OForm.composants[i]).image.bitmap.Largeur puis Col := TImage(OForm.composants[i]).image.bitmap.La largeur
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si Rgn1 = 0 alors Rgn1 := CreateRectRgn(TImage(OForm.composants[i]).gauche Début, TImage(OForm.composants[i]).Rangée du haut, TImage(OForm.composants[i]).gauche Col, TImage(OForm.composants[i]).haut de la Ligne 1)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp else begin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp & ! & ! & ! & ! & nbsp Rgn2 := CreateRectRgn(TImage(OForm.composants[i]).gauche Début, TImage(OForm.composants[i]).Rangée du haut, TImage(OForm.composants[i]).gauche Col, TImage(OForm.composants[i]).haut de la Ligne 1)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si (Rgn2 <> 0) alors CombineRgn(Rgn1,Rgn1,Rgn2,RGN_OR)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp Deleteobject(Rgn2)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & nbsp & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp:=faire 1
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp perc:=round(100*(/fullitems))
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp DoOnProgress(perc)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp combinergn(région,de la région,rgn1,rgn_or)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp rgn1:=0
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp else
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tr:=TControl(OForm.composants[i]).BoundsRect
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp & nbsp tr.à gauche:=tr.gauche
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tr.Haut:=tr.Top
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tr.Droit:=tr.Droite
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tr.En bas:=tr.Bas
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si la région=0, alors
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp région:=createRectRgn(tr.À gauche,tr.En haut,tr.Droit,tr.Bas)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp else
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & nbsp & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tregion:=createRectRgn(tr.À gauche,tr.En haut,tr.Droit,tr.En bas)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp:=faire 1
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp perc:=round(100*(/fullitems))
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp DoOnProgress(perc)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp combinergn(région,de la région,tregion,rgn_or)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp deleteObject(tregion)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & nbsp & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & nbsp fin
& nbsp & nbsp setwindowrgn(OForm.la poignée,de la région,true)
& nbsp & nbsp OForm.visible:=true
fin
Procédure TTransMake.Exécuter
begin
& nbsp & nbsp DrawTransparent
fin
procédure Register
begin
& nbsp & nbsp RegisterComponents('VNPVcls', [TTransMake])
fin
à la fin.









Un composant pour le rendre transparent (en forme de) formes


Un composant pour le rendre transparent (en forme de) formes : Plusieurs milliers de conseils pour vous faciliter la vie.


Le code ci-dessous est un composant pour creer transparent (en forme), les formulaires ...
Le code ci-dessous est un composant pour creer transparent (en forme) des formulaires en utilisant soit des bitmaps ou de controle, ou les deux. Il y a deux façons de raconter le composant que vous voulez utiliser comme un masque: la Balise de reglage (TransTag) ou d'un Composant de la liste ou vous suffit d'inserer le nom du composant comme une nouvelle ligne de texte.
Il y a meme un evenement a suivre l'etat d'avancement du processus, quand c'est long.
Pour les images, il s'agit d'un Masque de Couleur de la propriete, qui est la couleur qui sera transparent.
Utiliser la methode Execute pour faire de la transparence de la forme. Quand il n'y a pas beaucoup d'images, le processus est tres rapide et vous pouvez l'utiliser pour creer des effets d'animation sur votre bureau.
NOTE: pour la creation du Masque a partir d'images le composant prend en compte le composant TImage.
unite de TransMake
interface

& nbsp & nbsp Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,ExtCtrls
type
& nbsp & nbsp TProcessEvent=procedure(progres:longint) de l'objet
& nbsp & nbsp Par l' =(TBTag,TBComponentList)
& nbsp & nbsp TTransMake = class(TComponent)
& nbsp & nbsp prive
& ! & ! & ! & nbsp { Private declarations }
& ! & ! & ! & nbsp ITransTag:integer
& ! & ! & ! & nbsp ImageTrans:Boolean
& ! & ! & ! & nbsp ColorMask:TColor
& ! & ! & ! & nbsp region:hrgn
& ! & ! & ! & nbsp TransByV:Par l'
& ! & ! & ! & nbsp ComponentListV:TStrings
& ! & ! & ! & nbsp fullitems:LongInt
& ! & ! & ! & nbsp FOnProgress:TProcessEvent
& ! & ! & ! & nbsp procedure DrawTransparent
& ! & ! & ! & nbsp procedure ComponentListWrite(valeur:TStrings)
& ! & ! & ! & nbsp procedure SetTransBy(valeur:Par l')
& nbsp & nbsp protege
& ! & ! & ! & nbsp { declarations Protegees }
& ! & ! & ! & nbsp procedure DoOnProgress(progres:longint) dynamique
& nbsp & nbsp public
& ! & ! & ! & nbsp { Publc declarations }
& ! & ! & ! & nbsp Procedure d'Execution
& ! & ! & ! & nbsp Constructor Create(AOwner:TComponent) remplacer
& nbsp & nbsp publie
& ! & ! & ! & nbsp { Publie des declarations }
& ! & ! & ! & nbsp Propriete TransTag:Integer lire ITransTag ecrire ITransTag
& ! & ! & ! & nbsp Propriete ImageRegion:boolean lire ImageTrans ecrire ImageTrans
& ! & ! & ! & nbsp propriete MaskColor:TColor lire ColorMask ecrire ColorMask
& ! & ! & ! & nbsp propriete TransBy:Par lire TransByV ecrire SetTransBy par defaut TBTag
& ! & ! & ! & nbsp propriete ComponentList:TStrings lire ComponentListV ecrire ComponentListWrite
& ! & ! & ! & nbsp propriete OnProgress:TProcessEvent lire FOnProgress ecrire FOnProgress
& nbsp & nbsp fin
procedure Register
application
procedure TTransMake.DoOnProgress(progres:longint)
begin
& nbsp & nbsp si affecte(FonProgress)
& ! & ! & ! & nbsp TProcessEvent(FonProgress)(cours)
fin
procedure TTransMake.SetTransBy(Valeur:Par l')
begin
& nbsp & nbsp TransByV := Valeur
fin
procedure TTransMake.ComponentListWrite(Valeur:TStrings)
begin
& nbsp & nbsp ComponentListV.Attribuer(valeur)
fin
constructeur TTransMake.Create(AOwner:TComponent)
begin
& nbsp & nbsp herite Create(AOwner)
& nbsp & nbsp ComponentListV:=TStringList.Creer
& nbsp & nbsp ComponentListV.Add('Endroit de votre composant les noms ici.')
& nbsp & nbsp FullItems:=0
fin
procedure TTransMake.DrawTransparent
var
& nbsp & nbsp OForm:TForm
& ! & ! & ! & nbsp i,o,x,y,rx,ry:integer
& ! & ! & ! & nbsp tr:Trect
& ! & ! & ! & nbsp tregion,imgregion:Hrgn
& ! & ! & ! & nbsp proceder:boolean
& nbsp & nbsp TempBitmap: TBitmap
& nbsp & nbsp Rgn1, Rgn2: HRgn
& nbsp & nbsp Col, Debut, Ligne,test: integer
& nbsp & nbsp Ligne: PByteArray
& nbsp & nbsp faisant,perc:integer
begin
& nbsp & nbsp OForm:=TForm(owner)
& nbsp & nbsp region:=0
& nbsp & nbsp imgregion:=0
& nbsp & nbsp rgn1:=0
& nbsp & nbsp fullitems:=0
& nbsp & nbsp:=0
& nbsp & nbsp perc:=0
& nbsp & nbsp region:=createRectRgn(0,0,0,0)
& nbsp & nbsp rgn1:=createRectRgn(0,0,0,0)
& nbsp & nbsp OForm.visible:=false
& nbsp & nbsp OForm.BorderStyle:=bsNone
& nbsp & nbsp for i:=0 to OForm.ComponentCount-1 do
& ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & nbsp si TransBy=TBTag puis
& ! & ! & ! & ! & ! & ! & ! & nbsp si (OForm.Composants[i]).tag=TransTag puis
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp proceder:=true
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fullitems:=fullitems 1
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & nbsp si TransBy=TBComponentList puis
& ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si componentlistV.Count>0 then
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp pour o:=0 pour componentlistv.Count-1 do
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si (en Majuscules((OForm.Composants[i]).nom)=majuscule(componentlistv.Cordes[o]))
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fullitems:=fullitems 1
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & nbsp fin
& nbsp & nbsp for i:=0 to OForm.ComponentCount-1 do
& ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & nbsp proceder:=false
& ! & ! & ! & ! & ! & nbsp si TransBy=TBTag puis
& ! & ! & ! & ! & ! & ! & ! & nbsp si (OForm.Composants[i]).tag=TransTag puis
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp proceder:=true
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & nbsp si TransBy=TBComponentList puis
& ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si componentlistV.Count>0 then
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp pour o:=0 pour componentlistv.Count-1 do
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si (en Majuscules((OForm.Composants[i]).nom)=majuscule(componentlistv.Cordes[o]))
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp pro eed:=true
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & nbsp si procedez ensuite

& ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si TControl(OForm.composants[i]).visible
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si (OForm.composants[i] est TImage) et ImageRegion puis
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp avec TImage(OForm.composants[i]).image.image bitmap n'
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp pour la Ligne := 0 a TImage(OForm.composants[i]).image.bitmap.hauteur-1 do
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp Col := 0
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tandis que Col < TImage(OForm.composants[i]).image.bitmap.La largeur ne
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp & nbsp while (Col < TImage(OForm.composants[i]).image.bitmap.La largeur) et (Toile.pixels[col,row] = ColorMask) ne inc(Col)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si le Col >= TImage(OForm.composants[i]).image.bitmap.Largeur puis Continuer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp Debut := Col
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp while (Col < TImage(OForm.composants[i]).image.bitmap.La largeur) et (Toile.pixels[col,row] <> ColorMask) ne inc(Col)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si le Col >= TImage(OForm.composants[i]).image.bitmap.Largeur puis Col := TImage(OForm.composants[i]).image.bitmap.La largeur
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si Rgn1 = 0 alors Rgn1 := CreateRectRgn(TImage(OForm.composants[i]).gauche Debut, TImage(OForm.composants[i]).Rangee du haut, TImage(OForm.composants[i]).gauche Col, TImage(OForm.composants[i]).haut de la Ligne 1)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp else begin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp & ! & ! & ! & ! & nbsp Rgn2 := CreateRectRgn(TImage(OForm.composants[i]).gauche Debut, TImage(OForm.composants[i]).Rangee du haut, TImage(OForm.composants[i]).gauche Col, TImage(OForm.composants[i]).haut de la Ligne 1)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si (Rgn2 <> 0) alors CombineRgn(Rgn1,Rgn1,Rgn2,RGN_OR)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp Deleteobject(Rgn2)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & nbsp & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp:=faire 1
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp perc:=round(100*(/fullitems))
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp DoOnProgress(perc)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp combinergn(region,de la region,rgn1,rgn_or)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp rgn1:=0
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp else
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tr:=TControl(OForm.composants[i]).BoundsRect
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp & nbsp tr.a gauche:=tr.gauche
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tr.Haut:=tr.Top
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tr.Droit:=tr.Droite
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tr.En bas:=tr.Bas
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp si la region=0, alors
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp region:=createRectRgn(tr.A gauche,tr.En haut,tr.Droit,tr.Bas)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp else
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp commencer
& ! & ! & ! & ! & nbsp & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp tregion:=createRectRgn(tr.A gauche,tr.En haut,tr.Droit,tr.En bas)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp:=faire 1
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp perc:=round(100*(/fullitems))
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp DoOnProgress(perc)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp combinergn(region,de la region,tregion,rgn_or)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp deleteObject(tregion)
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & nbsp & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & ! & ! & ! & ! & nbsp fin
& ! & ! & ! & nbsp fin
& nbsp & nbsp setwindowrgn(OForm.la poignee,de la region,true)
& nbsp & nbsp OForm.visible:=true
fin
Procedure TTransMake.Executer
begin
& nbsp & nbsp DrawTransparent
fin
procedure Register
begin
& nbsp & nbsp RegisterComponents('VNPVcls', [TTransMake])
fin
a la fin.


Un composant pour le rendre transparent (en forme de) formes

Un composant pour le rendre transparent (en forme de) formes : Plusieurs milliers de conseils pour vous faciliter la vie.
Recommander aux amis
  • gplus
  • pinterest

Messages récents

Commentaire

Laisser un commentaire

évaluation