| 1:2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
 10:
 11:
 12:
 13:
 14:
 15:
 16:
 17:
 18:
 19:
 20:
 21:
 22:
 23:
 24:
 25:
 26:
 27:
 28:
 29:
 
 | procedure CropWindow( Handle: HWnd; Picture : TPicture; Color:TColor );var
 hrgn, hrgn1 : integer;
 hdc : integer;
 x, y : integer;
 begin
 hdc := GetDC( Handle );
 hrgn := CreateRectRgn( 0, 0, Picture.Graphic.Width, Picture.Graphic.Height );
 for x := 1 to Picture.Graphic.Width do
 for y := 1 to Picture.Graphic.Height do
 if Picture.Bitmap.Canvas.Pixels[ x - 1, y - 1 ] = Color then begin
 hrgn1 := CreateRectRgn( x - 1, y - 1, x, y);
 CombineRgn( hrgn, hrgn, hrgn1, RGN_DIFF );
 DeleteObject( hrgn1 );
 end;
 SetWindowRgn( Handle, hrgn, true );
 ReleaseDC( Handle, hdc);
 end;
 
 procedure UncropWindow( Handle: HWnd; Picture : TPicture );
 var
 hrgn : integer;
 hdc : integer;
 begin
 hdc := GetDC( Handle );
 hrgn := CreateRectRgn( 0, 0, Picture.Graphic.Width , Picture.Graphic.Height );
 SetWindowRgn( Handle, hrgn, true );
 ReleaseDC( Handle, hdc );
 end;
 |