Database 版 (精华区)
发信人: mengy (LEAR DLLS 命令时,将从内存中清除), 信区: Database
标 题: Visual FoxPro 5.0表单清屏特技
发信站: 哈工大紫丁香 (2000年12月13日09:14:10 星期三), 站内信件
Visual FoxPro 5.0表单清屏特技
在使用Visual FoxPro 5.0编制应用程序时,‘表单’大概是最常用的组成部
份,然而,时间一久,自然会有点厌了它那个一闪即现、转眼即逝的风格。笔者于
是试着改变表单的启动和关闭的方式,效果还算不错,有兴趣的读者不妨一试。
首先要进入Visual FoxPro 5.0系统环境中,建立一个新的表单(Form1),然
后再在表单上建立一个‘计时器’控件(Timer1),设置Timer1的InterVal属性为
100ms。接下来的工作就是为表单和计时器控件加入事件响应的代码:
启动表单
由左至右展开表单。
Form1的Load方法:
Public F_wid,I
F_WID = Thisform.Width
Thisform.Width = 0
I = 104
Timer1的Timer方法:
If I > F_wid
Thisform.Timer1.Enabled = .F.
Return
Endif
Thisform.Width = I
I = I + 10
由右至左展开表单。
Form1的Load方法:
Public F_wid,I
F_wid = Thisform.Width
Thisform.Left = Thisform.Left + F_wid - 104
Thisform.Width = 0
I = 104
Timer1的Timer方法:
If I >= F_wid
Thisform.Timer1.Enabled = .F.
Return
Endif
Thisform.Left = Thisform.Left - 10
Thisform.Width = I
I = I + 10
由上至下展开表单。
Form1的Load方法:
Public F_hei,I
F_hei = Thisform.Height
Thisform.Height = 0
I = 0
Timer1的Timer方法:
If I >= F_hei
Thisform.Timer1.Enabled = .F.
Return
Endif
Thisform.Height = I
I = I + 10
由下至上展开表单。
Form1的Load方法:
Public F_hei,I
F_hei = Thisform.Height
Thisform.Height = 0
Thisform.Top = Thisform.Top + F_hei
I = 0
Timer1的Timer方法:
If I >= F_hei
Thisform.Timer1.Enabled = .F.
Return
Endif
Thisform.Top = Thisform.Top - 10
Thisform.Height = I
I = I + 10
由左上角向右下角展开表单。
Form1的Load方法:
Public F_hei,F_wid,I
F_hei = Thisform.Height
F_wid = Thisform.Width
Thisform.Height = 0
Thisform.Width = 0
I = 0
Timer1的Timer方法:
If I >= F_hei
Thisform.Timer1.Enabled = .F.
Return
Endif
Thisform.Height = I
Thisform.Width = I * F_wid / F_hei
I = I + 10
由左下角向右上角展开表单。
Form1的Load方法:
Public F_hei,F_wid,I
F_hei = Thisform.Height
F_wid = Thisform.Width
Thisform.Height = 0
Thisform.Width = 0
Thisform.Top = Thisform.Height + F_hei
I = 0
Timer1的Timer方法:
If I >= F_hei
Thisform.Timer1.Enabled = .F.
Return
Endif
Thisform.Top = Thisform.Top - 10
Thisform.Height = I
Thisform.Width = I * F_wid / F_hei
I = I + 10
二、关闭表单
1、由左至右关闭表单。
Form1的Load方法:
Public F_wid,F_left
F_wid = Thisform.Width
F_left = Thisform.Left
Timer1的Timer方法:
If F_wid <= 100
Thisform.Timer1.Enabled = .F.
Thisform.Release
Endif
Thisform.Width = F_wid
Thisform.Left = F_left
F_wid = F_wid - 10
F_left = F_left + 10
2、由右至左关闭表单。
Form1的Load方法:
Public F_wid
F_wid = Thisform.Width
Timer1的Timer方法:
If F_wid <= 104
Thisform.Timer1.Enabled = .F.
Thisform.Release
Endif
Thisform.Width = F_wid
F_wid = F_wid - 10
由下至上关闭表单。
Form1的Load方法:
Public F_hei
F_hei = Thisform.Height
Timer1的Timer方法:
If F_hei <= 10
Thisform.Timer1.Enabled = .F.
Thisform.Release
Endif
Thisform.Height = F_hei - 10
F_hei = F_hei - 10
4、由上至下关闭表单。
Form1的Load方法:
Public F_hei
F_hei = Thisform.Height
Timer1的Timer方法:
If F_hei <= 10
Thisform.Timer1.Enabled = .F.
Thisform.Release
Endif
Thisform.Top = Thisform.Top + 10
Thisform.Height = F_hei
F_hei = F_hei - 10
5、由右上角向左下角关闭表单。
Form1的Load方法:
Public F_hei,F_wid,I
F_hei = Thisform.Height
F_wid = Thisform.Width
I = F_hei
Timer1的Timer方法:
If F_hei <= 10
Thisform.Timer1.Enabled = .F.
Thisform.Release
Endif
Thisform.Top = Thisform.Top + 10
Thisform.Height = F_hei
Thisform.Width = F_hei * F_wid / I
F_hei = F_hei - 10
由右下角向左上角关闭表单。
Form1的Load方法:
Public F_hei,F_wid,I
F_hei = Thisform.Height
F_wid = Thisform.Width
I = F_hei
Timer1的Timer方法:
If F_hei <= 10
Thisform.Timer1.Enabled = .F.
Thisform.Release
Endif
Thisform.Height = F_hei
Thisform.Width = F_hei * F_wid / I
F_hei = F_hei – 10
以上程序在Windows 95和Visual FoxPro 5.0中运行通过。
返回
--
大海无边天做岸
山登绝顶我为风
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.227.121]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.819毫秒