hinstance, nil);
sendmessage(wndcombo, wm_setfont,
sendmessage(awnd, wm_getfont, 0, 0),
1);
oldstyle := getwindowlong(wnd, gwl_style);
setwindowlong(wnd, gwl_style, oldstyle or tvs_showselalways);
saverect := rc;
wnd := getwindow(awnd, gw_child);
while iswindow(wnd) do begin
getwindowrect(wnd, rc);
screentoclient(awnd, rc.topleft);
screentoclient(awnd, rc.bottomright);
if (wnd<>wndcombo) and (rc.top>=saverect.top) then
setwindowpos(wnd, hwnd_notopmost, rc.left, rc.top+40, 0, 0, swp_nosize or swp_nozorder);
wnd := getwindow(wnd, gw_hwndnext);
end;
getwindowrect(awnd, rc);
setwindowpos(awnd, hwnd_notopmost, 0, 0, rc.right-rc.left, rc.bottom-rc.top+40, swp_nomove or swp_nozorder);
如果你过去很少用api写程序,那么这些代码可能让你看得有点头晕。基本上上述程序完成如下的工作:
(1)计算treeview在窗口中的位置;