GARANTIR DESCONTO

Fórum SetWindowRgn em TShape ou TImage #589497

04/12/2017

0

boa tarde,
tenho uma aplicação criada em delphi 7, estou usando uma rotina para recortar componentes em formatos diferentes, mas minha rotina só recorta TForm, TPanel, etc, gostaria fazer esse efeito de recorte de componente em um TShape e/ou Timage,
vai aki o procedimento que uso :

Procedure SetRegion(hHandle : HWND; iBitmap : Tbitmap);
var Region1hrgn : hRgn;
i1, count : integer;
x,y : integer;
c1 : cardinal;
c,t : tcolor;
Begin
Count := 0;
t := ibitmap.Canvas.Pixels[0,0];
With ibitmap.canvas do
begin
for y := 0 to ibitmap.Height-1 do
begin
x := 0;
while x < ibitmap.Width do
begin
C := pixels[ x, y ];
If C <> t Then
begin
i1 := x;
// C := pixels[x, i1];
while C <> t do
begin
Inc(i1);
// i1 := i1+1;
C := pixels[ i1, y ];
If i1 >= ibitmap.Width Then Break;
end;
c1 := CreateRectRgn( x,y, i1, y+1 );
If count = 0 then Region1hrgn := c1 else
begin
CombineRgn(Region1hrgn, Region1hrgn, c1, RGN_OR );
DeleteObject(c1);
end;
Inc(Count);
x := i1;
Continue;
end;
inc(x);
end;
end;
end;

If count > 0 then SetWindowRgn(hHandle, Region1hrgn, True);
end;
chamo ele assim :
SetRegion(TPanel.Handle, Image1.Picture.Bitmap);

alguém poderia me ajudar ?
Denilson Gama

Denilson Gama

Responder

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar