| 
			
				|  | VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
 
 |  
 
	
		| 上一篇主題 :: 下一篇主題 |  
		| 發表人 | 內容 |  
		| yoncen 
 
  
 註冊時間: 2005-08-29
 文章: 35
 
 
 第 1 樓
 
 | 
			
				|  發表於: 星期四 九月 29, 2005 12:10 pm    文章主題: VFP應用程式表單窗口平鋪效果實現 |   |  
				| 
 |  
				| ********************************** * VFP應用程式表單窗口平鋪效果實現
 * 作者:yoncen
 **********************************
 1.所有表單調用表單類_form
 _form.init()事件代碼
 *-- 表單狀態設置
 With This
 .cFormName=.Caption
 ToBar(.cFormName)
 .BorderStyle= 2
 .Icon="Images\Logo.ico"
 .MDIForm=.F.
 .ShowTips=.T.
 .oldWidth=.Width
 .oldHeight=.Height
 .chkFormType() &&檢查表單類型
 Endwith
 *-- 保存表單位置
 LOCAL cThisName
 cThisName=FindWin(This)
 If !Vartype(_Screen.&cThisName)="O" Then
 _Screen.AddObject(cThisName,"Custom")
 With _Screen.&cThisName.
 .AddProperty("LEFT",0)
 .AddProperty("TOP",0)
 Endwith
 Endif
 With _Screen.&cThisName.
 This.Left=This.Left+.Left
 This.Top=This.Top+.Top
 *-- 計算表單在屏幕中的位置
 If Sysmetric(2)-(This.Top+This.Height)>=140 Then
 .Left=.Left+20
 .Top=.Top+20
 Else
 .Left=0
 .Top=0
 Endif
 Endwith
 *-- 刷新工具條
 Local tForm,cForm,o
 tForm=Lower(Alltrim(FindWin(This)))
 For Each o In oMytoolsbar.Controls
 cForm=Alltrim(o.Name)
 cForm=Lower(Substrc(cForm,4,Len(cForm)))
 If cForm=tForm Then
 o.Enabled=.F.
 Exit
 Endif
 Next
 
 _form.QueryUnload()事件代碼
 Local cThisName
 cThisName=FindWin(This)
 oFormName=cThisName
 *-- 表單位置刷新
 If Vartype(_Screen.&cThisName)="O" Then
 With _Screen.&cThisName
 .Left=Iif(.Left=20,0,This.Left)
 .Top=Iif(.Top=20,0,This.Top)
 Endwith
 Endif
 *-- 恢復菜單項目狀態
 RF(cThisName)
 If This.FormType Then
 Thisformset.Hide
 Thisformset.Release
 Else
 Thisform.Hide
 Thisform.Release
 Endif
 *-- 刷新系統工具條
 If Vartype(oMytoolsbar)='O' Then
 oMytoolsbar.ReLoad()
 Endif
 ToBar("")
 
 2.調用自定義函數FindWin
 *-- 返回運行表單名稱
 FUNCTION FindWin(toForm)
 LOCAL lcFormName
 lcFormName=LEFT(JUSTFNAME(SYS(1271,toForm)),;
 ATC('.',JUSTFNAME(SYS(1271,toForm)))-1)
 RETURN lcFormName
 _________________
 從事企業ERP開發,學會止境,精益求精。
 |  |  
		| 回頂端 |  |  
		|  |  
		| goto-dream 
 
 
 註冊時間: 2004-05-11
 文章: 909
 
 
 第 2 樓
 
 |  |  
		| 回頂端 |  |  
		|  |  
		| goodnight 
 
  
 註冊時間: 2008-10-13
 文章: 473
 來自: 台南市
 
 第 3 樓
 
 | 
			
				|  發表於: 星期日 十二月 06, 2009 12:04 am    文章主題: |   |  
				| 
 |  
				| 感謝分享, 真是不錯的用途, 先存檔再說, 改天弄來嚇嚇 user |  |  
		| 回頂端 |  |  
		|  |  
		|  |  
  
  	| 
 
 | 您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章
 您 無法 在這個版面編輯文章
 您 無法 在這個版面刪除文章
 您 無法 在這個版面進行投票
 您 無法 在這個版面附加檔案
 您 無法 在這個版面下載檔案
 
 |  |