Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.06.14;
Скачать: CL | DM;

Вниз

SetWindowRgn   Найти похожие ветки 

 
Merl   (2005-04-22 22:25) [0]

Скажите пожалуйста, каким образом можно установить произвольную форму окна - не эллипс, не круг, а именно произвольную - например, как в тех же скинах для винампа - они хранят информацию о регионах окна в файле Regions.txt.
Или хотя бы скажите, как чуть-чуть скруглить только края формы?


 
Ученик   (2005-04-22 22:32) [1]

А как сделать круг ? Эллипс ?


 
Хинт ©   (2005-04-22 22:34) [2]

Установка формы окна по изображению (маске)

procedure SetBitmapRgn(Image: TBitmap);
var
 TmpRgn: HRGN;
 x, y: integer;
 ConsecutivePixels: integer;
 CurrentPixel: TColor;
 CurrentColor, TransColor: TColor;
 Result:HRGN;
begin
 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);
end;



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

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

Наверх




Память: 0.47 MB
Время: 0.033 c
1-1117000200
Mouserx
2005-05-25 09:50
2005.06.14
I/O Error 32


11-1098524553
AlexR
2004-10-23 13:42
2005.06.14
Цвет текста в RichEdit e


1-1117179617
Svit_men
2005-05-27 11:40
2005.06.14
Как подменить нажатую клавишу


1-1116987627
810
2005-05-25 06:20
2005.06.14
Посимвольно формировать String


1-1117529276
webpauk
2005-05-31 12:47
2005.06.14
работа с Pointer