Главная страница
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.021 c
1-85482
Ежик
2002-09-16 16:38
2002.09.26
Как из txt файла вывести в memo слова начинающие, на букву


14-85652
niko45
2002-08-29 22:53
2002.09.26
Нужен совет.


3-85375
Шурик Ш
2002-09-05 11:28
2002.09.26
Редактирование DBGrid


1-85504
kazaam
2002-09-17 09:16
2002.09.26
Есть ли замена таймеру?


4-85742
Иван
2002-08-09 13:42
2002.09.26
Перехват API