国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

淺談如何利用PB實現樹型列表動態半透明提示(四)(原創)

2024-07-21 02:10:11
字體:
來源:轉載
供稿:網友


作者:balloonman2002  2004年6月26日

4、創建用戶函數wf_maketrans,用于實現半透明效果:

long hdcscr,bhandle,hdest,frmdc,blendlng,copywidth,copyheight,copyleft,copytop,ret

long copywidth2,copyheight2,copyleft2,copytop2,mledc

long xdeviation,ydeviation

blendfunction blend

window lw_tmp

 

//blendlng = 11796480

blend.sourceconstantalpha = char(trans)

copymemory2(blendlng, blend, 4)

 

lw_tmp=frm.getparent()

//lw_tmp.setredraw(true)

copywidth = unitstopixels(frm.width, xunitstopixels!)

copyheight = unitstopixels(frm.height, yunitstopixels!)

copywidth2 = unitstopixels(mle.width, xunitstopixels!)

copyheight2 = unitstopixels(mle.height, yunitstopixels!)

//上述代碼用于坐標體系轉換

 

frm.x = xpos

frm.y = ypos

 

if lw_tmp.border <> false then

    ydeviation = getsystemmetrics(sm_cycaption) + getsystemmetrics(sm_cyframe)

    xdeviation = getsystemmetrics(sm_cxframe)

else

    ydeviation = 0

    xdeviation = 0

end if

 

if trim(lw_tmp.menuname) <> "" then

    ydeviation = ydeviation + getsystemmetrics(sm_cymenu)

end if

 

//也可以用clienttoscreen進行轉換

copyleft = unitstopixels((lw_tmp.x + xpos), xunitstopixels!) + xdeviation

copytop = unitstopixels((lw_tmp.y + ypos), yunitstopixels!) + ydeviation

copyleft2 = unitstopixels(mle.x, xunitstopixels!)

copytop2 = unitstopixels(mle.y, yunitstopixels!)

//上述代碼用于坐標體系轉換

 

hdcscr = getdc(0)

//獲取屏幕的設備句柄

hdest = createcompatibledc(hdcscr)

bhandle = createcompatiblebitmap(hdcscr, copywidth, copyheight)

ret = selectobject(hdest,bhandle)

frmdc = getdc(handle(frm))

mledc = getdc(handle(mle))

 

//此句可加可不加,主要是起清除原來圖象目的,防止圖象重疊,vb中此處必須要.cls,因為它具有autoredraw能力

//frm.setredraw(true)

//mle.setredraw(true)

 

//'此處一定要等待一段時間,否則窗體來不及hide,就已經被重新抓屏了

sleep(100)

 

ret = bitblt(hdest, 0, 0, copywidth, copyheight, hdcscr, copyleft , copytop , 13369376)

//上述代碼即將屏幕的截圖拷貝到內存緩存區域

 

//vb中form具有autoredraw的屬性可以自動重畫,pb無此能力,只好在此處就得顯示出來

if ib_first then

    wf_setrgn(frm)

end if

frm.visible = true

if ib_first then

    wf_setrgn(frm)

    ib_first = false

end if

ret = alphablend(frmdc, 0, 0, copywidth, copyheight, hdest, 0, 0, copywidth, copyheight, blendlng)

ret = alphablend(mledc, 0, 0, copywidth2, copyheight2, hdest, copyleft2 , copytop2, copywidth2, copyheight2, blendlng)

//上述代碼將內存緩存區域中的截圖拷貝到氣泡uo和其上的mle_1控件的hdc

 

//setnewrgn frm

wf_setrgn(frm)

 

ret = releasedc(0, hdcscr)

ret = releasedc(handle(frm), frmdc)

ret = releasedc(handle(mle), mledc)

ret = deletedc(hdest)

ret = deleteobject(bhandle)

//最后釋放或刪除獲取的內存對象

四、氣泡形狀效果實現

1、聲明本地外部函數:

function ulong createrectrgn(ulong x1,ulong y1,ulong x2,ulong y2) library "gdi32.dll"

function ulong createroundrectrgn(ulong x1,ulong y1,ulong x2,ulong y2,ulong x3,ulong y3) library "gdi32.dll"

function ulong createpolygonrgn(ref pointapi lppoint[],ulong ncount,ulong npolyfillmode) library "gdi32.dll"

function ulong combinergn(ulong hdestrgn,ulong hsrcrgn1,ulong hsrcrgn2,ulong ncombinemode) library "gdi32.dll"

function ulong createsolidbrush(ulong crcolor) library "gdi32.dll"

function ulong framergn(ulong hdc,ulong hrgn,ulong hbrush,ulong nwidth,ulong nheight) library "gdi32.dll"

function ulong setwindowrgn(ulong hwnd,ulong hrgn,boolean bredraw) library "user32.dll"

2、創建用戶函數wf_setrgn,用于創建氣泡形狀控件,該函數在上一小節的用戶函數wf_maketrans中予以調用:

long rgn_1,rgn_2,myrgn,hhbr,w,h,ret

pointapi shapev[]

   

    //初始化長、寬邊距

    w = unitstopixels(frm.width, xunitstopixels!)

    h = unitstopixels(frm.height, yunitstopixels!)

   

    //初始化右下腳三角頂點坐標

    shapev[1].x = w * (1 / 8)

    shapev[1].y = h - 30

    shapev[2].x = 0

    shapev[2].y = h

    shapev[3].x = w * (3 / 8)

    shapev[3].y = h - 30

     

    //開始創建指定圖形區域

    myrgn = createrectrgn(0, 0, 0, 0)

    rgn_1 = createroundrectrgn(0, 0, w, h - 20, 20, 20)

//創建橢圓角矩形區域

    rgn_2 = createpolygonrgn(shapev[],3,1)

    //創建任意多邊形區域

 

    //合并最終圖形

    ret = combinergn(myrgn, rgn_1, rgn_2, 2)

   

    // 創建用戶自定義顏色刷子

    hhbr = createsolidbrush(16479614)

//對最終圖形畫邊框

    ret = framergn(getdc(handle(frm)), myrgn, hhbr, 1, 1)

   

    //設置當前窗體使用此區域

    ret = setwindowrgn(handle(frm), myrgn, true)

     

    //釋放各對象

    ret = deleteobject(myrgn)

    ret = deleteobject(rgn_1)

    ret = deleteobject(rgn_2)

    ret = deleteobject(hhbr)

2、利用上述代碼可以輕松實現任務欄右下腳提示效果,如圖:

http://blog.csdn.net/images/blog_csdn_net/balloonman2002/17312/r_balloon-2.jpg

 

至此,樹型列表動態半透明效果提示全部完成,效果圖見:

http://blog.csdn.net/images/blog_csdn_net/balloonman2002/17312/r_balloon-1.jpg

如需要進一步資料,請聯系qq:27855043,msn:[email protected]

如有不當之處,敬盼您的指點。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 文水县| 巴南区| 普宁市| 黄龙县| 博客| 当雄县| 潼南县| 北海市| 教育| 康保县| 临江市| 巴南区| 丽水市| 永德县| 凭祥市| 施秉县| 高台县| 栖霞市| 光山县| 集安市| 梧州市| 屏山县| 晋宁县| 红桥区| 马鞍山市| 山丹县| 新河县| 巫溪县| 株洲县| 特克斯县| 唐河县| 嘉黎县| 江孜县| 巴塘县| 鄢陵县| 桦川县| 茂名市| 南华县| 五指山市| 商南县| 宜良县|