时间: 2021-07-31 作者:daque
范明之 用visual basic咱们可安排出不拘一格适合用户诉求的运用步调,它真实是一种很好的用户步调开拓东西,可vb供给的基础控件中都没有闪耀属性树立,使运用步调界面不足“活性”,近期笔者安排软硬件封皮时,就诉求字体连接地闪耀,为此,经重复领会、试验,结果毕竟胜利地实行字体闪耀功效,现将安排进程证明如次: (1)创造一个新目的文献(project1),并创造一个窗体form1。 (2)在form1上摆设一个计时器遏制timer1、标签控件label1、吩咐控件command1。 (3)各控件属性树立: timer1的enabled树立为true; label1的caption树立为需闪耀的字体:“江西省黎川县工作中等专业学校电脑室安排”、 font树立字体及巨细、backstyle树立为“0-transparent”; command第11中学的caption树立为“退出”。 (4)步调代码清单: option explicit private sub form_ load() label1.top=850 ′树立闪耀字体的表露场所 label1.left=750 timer1.interval=555 ′树立字体闪耀间隙功夫 form1.windowstate=2 end sub ′运用计时器控件timer有顺序地变换字体脸色(forecolor) private sub timer1_timer() chc label1,1,4,8 end sub ′chc进程是轮回地变换字体脸色(forecolor) sub chc(cont as control,color1 as integer,color2 as integer,color3 as integer) if val(cont.tag)=color1 then cont.tag=color2 elseif val(cont.tag)=color2 then cont.tag=color3 elseif val(cont.tag)=color3 then cont.tag=color1 else cont.tag=color1 end if cont.forecolor=qbcolor(cont.tag) end sub private sub command1_click() end end sub 步调除标签控件外,还实用于很多vb基础控件,实行诸多闪耀功效,比方:闪耀文本框、闪耀文献列表框等,极大充分了vb运用步调界面,十分适用。 此安排也实用vb3.0、vb4.0。