Вниз
Скачать: CL | DM;

Как сделать необычную ФОРМУ с TImage-ем?   Найти похожие ветки 

← →
Lamer666   (2007-12-09 10:11) [0]

Добрый день!
В общем сделал форму на ней Image разместил, как мне спрятать форму, чтобы при запуске был виден только мой IMAGE?
Спасибо!


← →
Nucer   (2007-12-09 11:41) [1]

procedure TForm1.SetBitmapRgn(bmp:string);
var
 TmpRgn: HRGN;
 x, y: integer;
 ConsecutivePixels: integer;
 CurrentPixel: TColor;
 CurrentColor, TransColor: TColor;
 Result: HRGN;
 Image:TBitmap;

begin
Image:=TBitmap.Create;
Image.LoadFromFile(bmp);

 Result := CreateRectRgn(0, 0, Image.Width, Image.Height);

 if (Image.Width = 0) or (Image.Height = 0) then exit;
 TransColor:=Image.Canvas.Pixels[0,0];

 for y := 0 to Image.Height - 1 do
   begin
   CurrentColor := Image.Canvas.Pixels[0,y];
   ConsecutivePixels := 1;
   for x := 0 to Image.Width - 1 do
     begin
     CurrentPixel := Image.Canvas.Pixels[x,y];

     if CurrentColor = CurrentPixel
       then inc(ConsecutivePixels)
       else begin
            if CurrentColor = TransColor then
              begin
              TmpRgn := CreateRectRgn(x-ConsecutivePixels, y, x, y+1);
              CombineRgn(Result, Result, TmpRgn, RGN_DIFF);
              DeleteObject(TmpRgn);
              end;
            CurrentColor := CurrentPixel;
            ConsecutivePixels := 1;
            end;
     end;

  if (CurrentColor = TransColor) and (ConsecutivePixels > 0) then
     begin
     TmpRgn := CreateRectRgn(x-ConsecutivePixels, y, x, y+1);
     CombineRgn(Result, Result, TmpRgn, RGN_DIFF);
     DeleteObject(TmpRgn);
     end;
   end;

SetWindowRgn(Self.Handle, Result, True);
Image.Free;
end;


← →
Lamer666   (2007-12-09 11:56) [2]


> TransColor:=Image.Canvas.Pixels[0,0];

Что такое? : )


← →
Nucer   (2007-12-09 12:02) [3]

Прозрачный цвет


← →
Lamer666   (2007-12-09 12:04) [4]

Извини, я имел ввиду, чье это свойство?
Уменя ругаеться приложение?


← →
Nucer   (2007-12-09 12:15) [5]

В раздел var посмотри =)

var
TmpRgn: HRGN;
x, y: integer;
ConsecutivePixels: integer;
CurrentPixel: TColor;
CurrentColor, TransColor: TColor;
Result: HRGN;
Image:TBitmap;


← →
Lamer666   (2007-12-09 12:18) [6]


> CurrentColor, TransColor: TColor;

Ой извини! : ))


← →
Lamer666   (2007-12-09 17:32) [7]


> Nucer

СПАСИБО БОЛЬШОЕ!


← →
Вредитель ©   (2007-12-11 11:26) [8]

Зачем все эти  HRGN, просто:
Borderstyle:=bsNone;
image1.transparent:=true;
transparentcolor:=true;
transparentcolorvalue:=clBlack;
color:=clblack;



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

Скачать: CL | DM;



Память: 0.46 MB
Время: 0.009 c
3-1204731053
nstur
2008-03-05 18:30
2008.08.31
Как в ADO открыть запароленную БД Access


15-1215472450
Хохол
2008-07-08 03:14
2008.08.31
Система сообщений(философия)


2-1215326275
Незнайка
2008-07-06 10:37
2008.08.31
EHLib и выпадающее меню


6-1192114180
ggg
2007-10-11 18:49
2008.08.31
net share


4-1194929446
balepa
2007-11-13 07:50
2008.08.31
CE_FRAME




   Наверх