王朝网络
分享
 
 
 

浅谈如何利用PB实现仿QQ自动显示/隐藏窗口(三)(原创)

王朝other·作者佚名  2006-01-30
宽屏版  字体: |||超大  

作者: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:WEIYIN2001@MSN.COM

如有不当之处,敬盼您的指点。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
>>返回首页<<
推荐阅读
 
 
频道精选
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
© 2005- 王朝网络 版权所有