Главная страница
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.009 c
2-1216804295
Dimich1978
2008-07-23 13:11
2008.08.31
Как удалить из doc определеные строки


6-1192552967
Matrex
2007-10-16 20:42
2008.08.31
Проверка существования URL


2-1216797045
Dimich1978
2008-07-23 11:10
2008.08.31
Открытие файла с изменение полей в WORDе


1-1195976284
DmT
2007-11-25 10:38
2008.08.31
Как засунуть форму в TaskBar, ввиде отдельной панельки


2-1216906793
wiii
2008-07-24 17:39
2008.08.31
TToolBar, хочу сделать наследника