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

Вниз

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

 
anod ©   (2002-08-10 19:44) [0]

Почему-то не хочет работать.

function CreateRgnFromBitmap(rgnBitmap: Bitmap): HRGN;
type
TColor = -$7FFFFFFF-1..$7FFFFFFF;
var
transColor: TColor;
i, j: Integer;
width, height: Integer;
left, right: Integer;
rectRgn: HRGN;
begin
Result := 0;
width := rgnBitmap.bmWidth;
height := rgnBitmap.bmHeight;
transColor := GetPixel(main_bmp,width - 1, height - 1);
for i := 0 to height - 1 do
begin
left := -1;
for j := 0 to width - 1 do
begin
if left < 0 then
begin
if GetPixel(main_bmp,j, i) <> transColor then
left := j;
end
else
if GetPixel(main_bmp,j, i) = transColor then
begin
right := j;
rectRgn := CreateRectRgn(left, i, right, i + 1);
if Result = 0 then
Result := rectRgn
else
begin
CombineRgn(Result, Result, rectRgn, RGN_OR);
DeleteObject(rectRgn);
end;
left := -1;
end;
end;
if left >= 0 then
begin
rectRgn := CreateRectRgn(left, i, width, i + 1);
if Result = 0 then
Result := rectRgn
else
begin
CombineRgn(Result, Result, rectRgn, RGN_OR);
DeleteObject(rectRgn);
end;
end;
end;
end;
...
MainWnd:=InitInstance;
if (MainWnd = 0) then MessageBox(0, "Ошибка создания окна", nil, MB_OK)
else
begin
main_bmp:=LoadImage(0,PCHAR(ExtractFilePath(ParamStr(0)) + "skin\default\main.bmp"), IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
GetObject(main_bmp, SizeOf(Bitmap), @bmp);
Width:=bmp.bmWidth; Height:=bmp.bmHeight;
SetWindowPos(MainWnd,HWND_TOPMOST,20,0,Width,Height,SWP_NOZORDER);
SetWindowLong(MainWnd, GWL_STYLE, WS_SYSMENU or WS_TABSTOP
or WS_CLIPCHILDREN);
SetWindowRgn(MainWnd,CreateRgnFromBitmap(bmp),true);


 
anod ©   (2002-08-11 14:03) [1]


Странно, если поменять так
SetWindowRgn(MainWnd,CreateRgnFromBitmap(bmp),true);
SetWindowPos(MainWnd,HWND_TOPMOST,20,0,Width,Height,SWP_NOZORDER);
SetWindowLong(MainWnd, GWL_STYLE, WS_SYSMENU or WS_TABSTOP or WS_CLIPCHILDREN);
Вырисовывается caption окна, хотя при создпнии окна я не пишу WS_CAPTION



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

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

Наверх




Память: 0.47 MB
Время: 0.016 c
7-85721
vasya_dvc
2002-07-16 12:15
2002.09.26
Запуск приложения через асм.


1-85555
Skywalker
2002-09-12 13:29
2002.09.26
сортировака


4-85765
vitandr
2002-08-12 09:55
2002.09.26
Добавление пункта в Popup меню


1-85497
NewInDelphi
2002-09-15 02:20
2002.09.26
Поиск в битмапе


1-85599
bamper
2002-09-13 18:42
2002.09.26
Низкоуровневое программирование