我要投稿
  • 您當前的位置:中國教育資源網 -> 技術教程 -> 數據庫教程 -> VFP教程 -> 教程內容
  • [ 收藏本頁教程 ]
  • 窗體動態效果的實現VFP教程

    教程作者:佚名    教程來源:不詳   教程欄目:VFP教程    收藏本頁

        最近用pb做了一個觸摸屏的程序,項目組要求窗口顯示關閉的時候有點動態效果,于是我就寫了如下的程序,供大家參考借鑒。


      ---------------------------------
      // 實現關閉窗體時的動態效果
      // -------------------------------
      // 函數名:gf_closequery
      // 參數說明:
      //         window    window類型,調用窗口的名字
      //         closetype integer類型,窗口關閉方式,value = 0~10
      // -------------------------------
      // 申明局部變量
      int li_x ,li_y,li_width,li_height,li_ceny,li_cenx,li_xminusy,li_wminush
      Integer li_gd

      // 取出當前窗口的坐標值、大小值
      li_x = window.x
      li_y = window.y
      li_width = window.width
      li_height = window.height

      // 設置窗體關閉前的動畫效果
      // 關鍵是看哪個值發生了變化——x、y、h、w
      CHOOSE CASE closetype
       CASE 0      // closetype = 0,從下到上逐漸消失
      for li_gd = li_height to 0 step -1
       window.height = li_gd
       window.show()
      next
     CASE 1      // closetype = 1,從上到下逐漸消失
      for li_gd = li_y to li_height+li_y step 1
       window.y = li_gd
       window.height = li_height+li_y - li_gd
       window.show()
      next
     CASE 2      // closetype = 2,從右到左逐漸消失
      for li_gd =  li_width to 0 step -1
       window.width = li_gd
      next
     CASE 3      // closetype = 3,從左到右逐漸消失
      for li_gd =  li_x to li_x+li_width step 1
       window.x = li_gd
       window.width = li_x+li_width - li_gd
       window.show()
       next
      case 4      // closetype = 4,從上下向中間擠壓逐漸消失
      li_ceny = li_y+li_height/2
      for li_gd = li_y to li_ceny step 1
       window.y = li_gd
       window.height = li_height - 2*(li_gd - li_y)
      next
     case 5      // closetype = 5,從左右向中間擠壓逐漸消失
      li_cenx = li_x+li_width / 2
      for li_gd = li_x to li_cenx step 1
       window.x = li_gd
       window.width = li_width - 2*(li_gd - li_x)
      next
     case 6      // closetype = 6,從左上->右下
      for li_gd = li_y to li_height+li_y step 1
       window.y = li_gd
       window.height = li_height+li_y - li_gd
       if window.x < li_x + li_width then
        window.x = li_x + (li_gd - li_y)
       else
        window.x = li_x + li_width
       end if
       if window.width > 0 then
        window.width = li_x+li_width - window.x
       else
        window.width = 0
       end if
      next
      window.x = li_x + li_width
      window.y = li_height+li_y
      window.width = 0
      window.height = 0
       window.show()
       case 7      // closetype = 7,從右下->左上
      for li_gd = li_height to 0 step -1
       window.height = li_gd
       if window.width > 0 then
        window.width = li_width - (li_height - li_gd)
       else
        window.width = 0
       end if
      next
      window.x = li_x
      window.y = li_y
      window.width = 0
      window.height = 0
      window.show()
     case 8      // closetype = 8,從右上->左下
      for li_gd = li_y to li_height+li_y step 1
       window.y = li_gd
       window.height = li_height+li_y - li_gd
       if window.width > 0 then
        window.width = li_width - (li_gd - li_y)
       else
        window.width = 0
       end if
      next
      window.x = li_x
      window.y = li_height+li_y
      window.width = 0
      window.height = 0
      window.show()
       case 9      // closetype = 9,從左下->右上
      for li_gd = li_x to li_x+li_width step 1
       window.x = li_gd
       window.width = li_width +li_x -li_gd
       if window.height > 0 then
        window.height = li_height -(li_gd - li_x)
       else
        window.height = 0
       end if
      next
      window.x = li_x+li_width
      window.y = li_y
      window.width = 0
      window.height = 0
      window.show()
     case 10      // closetype = 10,從四面到中間
      li_ceny = li_y+li_height/2
      li_cenx = li_x+li_width / 2
      for li_gd = li_y to li_ceny step 1
       window.y = li_gd
       window.height = li_height - 2*(li_gd - li_y)
       if window.x < li_x + li_cenx then
        window.x = li_x + (li_gd - li_y)
       else
        window.x = li_x + li_cenx
       end if
       if window.width > 0 then
        window.width = li_width - 2*(li_gd - li_y)
       else
        window.width = 0
       end if
      next
      window.x = li_cenx
      window.y = li_ceny
      window.width = 0
      window.height = 0
      window.show()
     case else
      window.show()
      window.width = li_width
      window.height = li_height
      window.x = li_x
      window.y = li_y
    END CHOOSE
    return 0
    ************************
    // 調用該函數在窗體的 closequery 事件中
    gf_closequery (w_main,mod(integer(string(now(),"ss")),11))

     

    我要投稿   -   廣告合作   -   關于本站   -   友情連接   -   網站地圖   -   聯系我們   -   版權聲明   -   設為首頁   -   加入收藏   -   網站留言
    Copyright © 2009 - 20012 www.mmogirl.net All Rights Reserved.中國教育資源網 版權所有  
     
    潘甜甜七夕果冻传媒在线_月夜影视在线观看免费完整_国产成人18黄网站视频_亚洲无?码国产精品