Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "WinAPI";
Текущий архив: 2005.06.14;
Скачать: [xml.tar.bz2];

Вниз

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 вся ветка

Форум: "WinAPI";
Текущий архив: 2005.06.14;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.033 c
8-1109285044
Tga
2005-02-25 01:44
2005.06.14
Как преобразовать bmp в tga ? Оба 32 бит.


14-1116928913
Stef
2005-05-24 14:01
2005.06.14
сжатие exe-файла


1-1116719790
scrazy
2005-05-22 03:56
2005.06.14
7 и 8 Преобразования грамматик.


14-1116931370
VX
2005-05-24 14:42
2005.06.14
Где узнать Все свойства Всех компонент Delphi?


1-1117568825
Demonix
2005-05-31 23:47
2005.06.14
объект Edit1 и командная строка





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский