浅谈如何利用PB实现树型列表动态半透明提示(二)(原

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

作者:BALLOONMAN2002  2004年6月26日<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

二、如何获取当前鼠标坐标对应NODE结点信息

1、新建一窗口,内含一TREEVIEW控件;

2、声明本地外部函数:

Function ulong SendMessage1(ulong hwnd,ulong wMsg,ulong wParam,ref TVHITTESTINFO lParam) LIBRARY "user32.dll" ALIAS FOR "SendMessageA"

Function ulong SendMessage2(ulong hwnd,ulong wMsg,ulong wParam,ref TVITEM lParam) LIBRARY "user32.dll" ALIAS FOR "SendMessageA"

SUBROUTINE  CopyMemory  (ref string Destination , long Source, long Length)  LIBRARY "kernel32"  Alias for "RtlMoveMemory"

Function ulong GlobalFree(ulong hMem) LIBRARY "kernel32.dll"

Function ulong GlobalAlloc(ulong wFlags,ulong dwBytes) LIBRARY "kernel32.dll"注:上述API声明涉及到的结构请查阅MSDN或其他技术资料。

3、对于该TREEVIEW控件自定义用户事件UE_MOUSEMOVE(PBM_MOUSEMOVE),在此事件当中处理鼠标移动事件,发送TVM_HITTEST消息:

tpoint ptA

tvhittestinfo tf

TVITEM tv

ulong hItem,ll_1,ll_2,ll_3,hStr

long ret,ll_x,ll_y

string astr,bstr,ls_help

 

ptA.x = UnitsToPixels(xpos, XUnitsToPixels!)

ptA.y = UnitsToPixels(ypos, YUnitsToPixels!)

tf.pt = ptA

tf.flags = 4

 

hItem = SendMessage1(handle(tv_1),4369,0,tf)

//注:上述4369为TVM_HITTEST

//通过发送TVM_HITTEST消息来获取当前对应的NODE的句柄,,将当前NODE结点信息保存到结构变量 TF当中

If ((hItem <= 0) Or (hItem = hItemPrv)) Then return

 

hItemPrv = hItem

hStr = GlobalAlloc(0,1024)

 

If hStr > 0 Then

    tv.mask = 1

    tv.HTreeItem = hItem

    tv.pszText = hStr

    tv.cchTextMax = 1023

    ret = SendMessage2(handle(tv_1), 4364, 0, tv)

//注:上述4364为TVM_GETITEM

//通过对当前NODE发送TVM_GETITEM消息,将当前NODE结点信息保存到结构变量 TV当中

    astr = space(1024)

//注:此处一定要分配足够空间,否则易非法操作

    CopyMemory(astr, hStr, 1024)

    //bstr = Left(astr, (pos(astr, Char(0)) - 1))

    ret = GlobalFree(hStr)

    ids_ds.setfilter("")

    ids_ds.filter()

    ret = ids_ds.find("name_gn = '" + astr + "'",1,ids_ds.rowcount())

    if ret > 0 then

        ls_help = ids_ds.getitemstring(ret,"help")

        if (isnull(ls_help) or trim(ls_help) = "")  then

            timer(0)

            iuo_tips.hide()

        else

            if is_help = ls_help then

                return

            end if

            iuo_tips.hide()

            iuo_tips.uf_set_text(ls_help,astr)

            ib_tipshow = false

            Timer(1)

        end if

        is_help = ls_help

    else

        timer(0)

        iuo_tips.hide()

    end if

else

    timer(0)

    iuo_tips.hide()

end if

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
阅读更多
个人分类: 数据库
想对作者说点什么? 我来说一句

PB自动提示

2014年09月03日 17KB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭