Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2008.08.31;
Скачать: 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 вся ветка

Текущий архив: 2008.08.31;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.015 c
15-1215684599
AlexanderMS
2008-07-10 14:09
2008.08.31
Программа для уменьшения количества цветов на изображении.


15-1215672165
ееееееекенитен
2008-07-10 10:42
2008.08.31
есть ли обновляемый список сайтов с играми/ порнухой и пр?


10-1148641186
Davinchi
2006-05-26 14:59
2008.08.31
Обработчик события OnKeyDown в ActiveFormX не реагирует на ...


15-1215775699
Andy BitOff
2008-07-11 15:28
2008.08.31
Прогресс бар при сохранении документа в Ворде


15-1215750791
shlst
2008-07-11 08:33
2008.08.31
А чего это дедушки волнуются -