Window SubClassing另类运用(之二)[6]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 weizhisheng 的 blog

                         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在窗口中的位置;


本文关键:Delphi,API,Subclass
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top