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

首頁 > 開發 > 綜合 > 正文

淺談如何利用PB實現仿QQ自動顯示/隱藏窗口(三)(原創)

2024-07-21 02:10:10
字體:
來源:轉載
供稿:網友
  • 本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。

  • 作者:balloonman2002  2004年6月26日

    四、顏色條滾動效果實現

    1、獲取該窗口的hdc(設備句柄),即在窗口的open事件當中編寫:

    聲明全局變量:long gl_hdc

    聲明外部函數:function ulong getdc(ulong hwnd) library "user32.dll"

    gl_hdc = getdc(handle(this))

    2、創建一個timing類型用戶對象user object,用于動態繪制彩色矩形:

    (1)首先聲明該對象實例變量:

    integer ii_turn

    str_rect is_rect_all,is_rect_form

    long il_hbrush,il_target_height,il_target_width,il_target_pace,il_height_base

    (2)初始化該用戶對象,編寫其constructor事件:

    ii_turn = 1

    il_target_width = unitstopixels(w_function.width , xunitstopixels!)

    //設置整個目標區域的寬度

    il_target_height = unitstopixels(w_function.height , yunitstopixels!)

    //設置整個目標區域的高度

    il_target_pace = 15 //設置彩色顏色條滾動步距

    il_height_base = 100 //設置彩色顏色條寬度

     

    is_rect_all.left = il_target_width - unitstopixels(30 , xunitstopixels!)

    is_rect_all.right = il_target_width

     

    is_rect_form.top = 0

    is_rect_form.bottom = il_target_height

    is_rect_form.left = is_rect_all.left

    is_rect_form.right = is_rect_all.right

     

    il_hbrush = createsolidbrush(gl_backcolor)

    (3)開始具體編寫動態顏色條滾動效果代碼,即處理該對象的timer事件:

    str_rect ls_rect_tmp

    long ll_tmp,ll_ret,ll_hbrush

    integer li_red,li_green,li_blue

     

    if ii_turn = 1 then

        if is_rect_all.top < il_target_height - il_height_base - il_target_pace then

          is_rect_all.top = is_rect_all.top + il_target_pace

        else

          is_rect_all.top = il_target_height - il_height_base

          ii_turn = -1

        end if

    else

        if is_rect_all.top > il_target_pace then

          is_rect_all.top = is_rect_all.top - il_target_pace

        else

          is_rect_all.top = 0

          ii_turn = 1

        end if

    end if

     

    is_rect_all.bottom = is_rect_all.top + il_height_base

     

    //w_function.backcolor = gl_backcolor

     

    ll_ret = fillrect(gl_hdc, is_rect_form, il_hbrush) //注:這樣比上面一句效率高

     

    li_red = mod(gl_backcolor,256)

    li_green = truncate(mod((gl_backcolor - li_red),65536) / 256 , 0)

    li_blue = truncate(gl_backcolor / 65536 , 0)

     

    ls_rect_tmp.left = is_rect_all.left

    ls_rect_tmp.right = is_rect_all.right

     

    if ii_turn = 1 then

        ls_rect_tmp.bottom = is_rect_all.top

        do while ls_rect_tmp.bottom < is_rect_all.bottom

            li_red = li_red - 20  //注:這里的20決定了顏色的深淺程度       li_green = li_green - 20

            li_blue = li_blue - 20

            if li_red < 0 then

                li_red = 0

            end if

            if li_green < 0 then

                li_green = 0

            end if

            if li_blue < 0 then

                li_blue = 0

            end if

            ll_hbrush = createsolidbrush(rgb(li_red,li_green,li_blue))

            ls_rect_tmp.top = ls_rect_tmp.bottom

            ls_rect_tmp.bottom = ls_rect_tmp.top + 25  //注:這里的25決定了漸變的快慢程度

            ll_ret = fillrect(gl_hdc, ls_rect_tmp, ll_hbrush)

            ll_ret = deleteobject(ll_hbrush)

        loop

    else

        ls_rect_tmp.top = is_rect_all.bottom

        do while ls_rect_tmp.top > is_rect_all.top

            li_red = li_red - 20

            li_green = li_green - 20

            li_blue = li_blue - 20

            if li_red < 0 then

                li_red = 0

            end if

            if li_green < 0 then

                li_green = 0

            end if

            if li_blue < 0 then

                li_blue = 0

            end if

            ll_hbrush = createsolidbrush(rgb(li_red,li_green,li_blue))

            ls_rect_tmp.bottom = ls_rect_tmp.top

            ls_rect_tmp.top = ls_rect_tmp.bottom - 25

            ll_ret = fillrect(gl_hdc, ls_rect_tmp, ll_hbrush)

            ll_ret = deleteobject(ll_hbrush)

        loop

    end if

    3、在主window窗口中調用此timing對象:

    (1)處理open事件:iuo_timer = create uo_timer

    (2)處理wf_hide_h/v事件:iuo_timer.start(0.2)

    (3)處理close事件:destroy iuo_timer

     

    至此,仿qq自動顯示/隱藏加顏色條滾動效果窗口全部完成。

    由于我自己是分在兩個程序當中實現上述兩種效果,故無法給出完整的示意圖,僅以如下兩圖示例:

    http://blog.csdn.net/images/blog_csdn_net/balloonman2002/17312/r_autohide.jpg

    http://blog.csdn.net/images/blog_csdn_net/balloonman2002/17312/r_scroll_eff.jpg

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

    如有不當之處,敬盼您的指點。
    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 贵港市| 平远县| 繁峙县| 金山区| 宁安市| 孝昌县| 瓦房店市| 北安市| 黄石市| 安新县| 无棣县| 昭平县| 冷水江市| 西乡县| 白玉县| 台北市| 望江县| 邵阳县| 南宫市| 禄丰县| 师宗县| 荣成市| 错那县| 阿图什市| 新郑市| 昭平县| 丰城市| 本溪市| 托克托县| 五莲县| 衡水市| 三门县| 青阳县| 景谷| 大竹县| 南丰县| 诸暨市| 广安市| 道孚县| 汝阳县| 乌拉特前旗|