Главная страница
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.019 c
4-85755
Aydar
2002-08-11 02:53
2002.09.26
Always on Top


7-85726
ZZ
2002-06-28 14:00
2002.09.26
Проблема с юникодом


1-85550
Виталий Панасенко
2002-09-12 09:16
2002.09.26
Использования консольного приложения в батнике


3-85346
Lina
2002-09-04 13:41
2002.09.26
Вычисляемые поля ...


1-85538
Pvk2002
2002-09-12 11:17
2002.09.26
Вопрос с System Tray