  | 
				VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.   
				 | 
			 
		 
		 
	
		| 上一篇主題 :: 下一篇主題   | 
	 
	
	
		| 發表人 | 
		內容 | 
	 
	
		perry
 
 
  註冊時間: 2014-07-20 文章: 203
 
  第 1 樓
  | 
		
			
				 發表於: 星期日 九月 10, 2017 2:54 am    文章主題: 有點小繁瑣自製 sql 進度條 | 
				     | 
			 
			
				
  | 
			 
			
				set near on
 
sele 0
 
use test orde 1 alia a_1
 
** 
 
a_kk=截止範圍主鍵值+1
 
seek a_kk
 
skip -1
 
a_recc=recn()
 
**
 
sele 0
 
sele * from a_1 wher 主鍵值欄位#' ' and mylinebr('a_1',主鍵值欄位,a_recc) into curs a_2
 
brow
 
use in a_2
 
use in a_1
 
****
 
proc mylinebr
 
lpar x_alia,x_kk,x_recc
 
priv o_alia,o_kk,o_recc,o_recn
 
o_alia=x_alia
 
o_kk=x_kk
 
o_recc=x_recc
 
sele (o_alia)
 
seek o_kk
 
o_recn=recno()
 
wait wind chr(13)+allt(str(o_recn))+'/'+allt(str(o_recc)) nowa noclear
 
=inkey(.2)
 
retu .t. | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		perry
 
 
  註冊時間: 2014-07-20 文章: 203
 
  第 2 樓
  | 
		
			
				 發表於: 星期二 九月 12, 2017 2:41 pm    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				經測試在自定函數中直接取 recno() 即可 = ='''
 
但alia()不是 sele * from xxx 的名稱
 
sele sql 會自動 use dbf agai 作為過濾用 | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		perry
 
 
  註冊時間: 2014-07-20 文章: 203
 
  第 3 樓
  | 
		
			
				 發表於: 星期三 九月 13, 2017 12:32 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				 	  | 代碼: | 	 		  
 
set near on
 
set dele on
 
priv a_1,a_2,a_recc,a_cnt
 
** 查詢期間 2017/01 ~ 2017/06
 
sele 0
 
use test orde idx_1 alia a_1
 
** inde on tdate tag idx_1
 
seek '2017/07'
 
skip -1
 
a_recc=recno()
 
a_cnt=0  &&最後資料記錄變數
 
sele 0
 
sele * from a_1 wher tdate>='2017/01' and tdate<='2017/06' ;
 
    and mylinebr(thisform,a_recc,'a_cnt') into curs a_2
 
go top
 
brow
 
use in a_2
 
use in a_1
 
retu
 
 | 	  
 
 	  | 代碼: | 	 		  
 
proc mylinebr
 
lpar x_thisform,x_recc,x_cnt
 
priv o_tform_rno,o_recc,o_cnt
 
o_tform=x_thisform
 
o_cnt=x_cnt
 
if vartype(o_tform.mbar1)#'O'
 
    o_tform.addobject('mbar1','msqlbar1')
 
endi
 
o_rno=recn()
 
if o_rno<&o_cnt
 
    o_rno=&o_cnt
 
else
 
    &o_cnt=o_rno
 
endi
 
o_recc=x_recc
 
if o_rno>o_recc
 
    o_rno=o_recc
 
endi
 
priv o_p
 
o_p=int(o_rno*100/o_recc)
 
with o_tform.mbar1
 
    .label1.caption=allt(str(o_p))+'%'
 
    .label2.width=o_p*2
 
    .visible=.t.
 
    .zorder(0)
 
endwith
 
*if &o_rno<o_recc
 
*    &o_rno=&o_rno+1
 
*endi
 
if o_rno=o_recc &&結束時隱藏
 
    inkey(.2)
 
    o_tform.mbar1.visible=.f.
 
else
 
    inkey(.05)&&測試�[測用
 
endi
 
retu .t.
 
 
define class msqlbar1 as container
 
    add object label2 as label
 
    add object label1 as label
 
    proc init
 
        with this
 
            .visible=.f.
 
            .specialeffect=1
 
            .width=208
 
            .height=font(1,'細明體',12)+8
 
            .backcolor=rgb(255,248,255)
 
            .label1.backstyle=0
 
            .label1.visible=.t.
 
            .label1.borderstyle=0
 
            .label1.width=200
 
            .label1.alignment=2
 
            .label1.fontname='細明體'
 
            .label1.fontsize=12
 
            .label1.caption=''
 
            .label1.forecolor=rgb(0,0,192)
 
            .label1.height=.height-2
 
            .label2.visible=.t.
 
            .label2.borderstyle=0
 
            .label2.width=0
 
            .label2.caption=''
 
            .label2.height=.height-2
 
            .label2.backcolor=rgb(255,255,0)
 
            .label2.backstyle=1
 
            .label1.left=2
 
            .label2.left=2
 
            .label1.top=2
 
            .label2.top=2
 
            .top=int((.parent.height-.height)/2)
 
            .left=int((.parent.width-.width)/2)
 
        endwith
 
    endproc
 
enddefine
 
 | 	 
  | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		goodnight
 
  
  註冊時間: 2008-10-13 文章: 473 來自: 台南市
  第 4 樓
  | 
		 | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
  	 
	    
  	   | 
 	
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
  | 
   
  
		 |