Главная страница
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.054 c
14-1117095731
Nic87
2005-05-26 12:22
2005.06.14
Вопрос модераьорам


1-1117524388
sofs
2005-05-31 11:26
2005.06.14
Мемо


1-1116922813
r13
2005-05-24 12:20
2005.06.14
Мерцание формы


1-1117469400
Alexander Panov
2005-05-30 20:10
2005.06.14
Скрыть public-метод в наследнике.


3-1115389297
Karburator
2005-05-06 18:21
2005.06.14
(SQL) integer в дату