其实我想问的是VFP如何像全面控制EXCEL一样,能全面控制记事本,或者谁知道调用API来控制的,请高手教我。
CLEAR ALL Main() CLEAR ALL RETURN PROCEDURE Main() LOCAL loForm loForm = CREATEOBJECT("_Form") WITH loForm .Caption = "显示文本文件测试用例" .AutoCenter = .T. && 窗体启动后在主窗体中居中 WITH .Edit1 .FontName = "微软雅黑" && 设置文本显示字体 .Value = FILETOSTR("备忘.TXT") && 把文件名改为你电脑中存在的文件即可,可带路径 ENDWITH .Show ENDWITH READ EVENTS && 启动事务处理循环,否则窗体一闪即逝 ENDPROC DEFINE CLASS _Form AS Form ADD OBJECT Edit1 AS EditBox ADD OBJECT Label1 AS Label WITH Caption = "字体大小:", Height = 25, Width = 80, Alignment = 1 ADD OBJECT Text1 AS TextBox WITH Height = 25, Width = 60, InputMask = "99", SelectOnEntry = .T. ADD OBJECT Command1 AS CommandButton WITH Caption = "确定", Height = 25, Width = 40 PROCEDURE Arrange WITH This.Label1 .Top = ThisForm.Height - .Height - 5 .Left = 5 ENDWITH WITH This.Text1 .Top = ThisForm.Label1.Top .Left = This.Label1.Left + This.Label1.Width ENDWITH WITH Top = This.Text1.Top .Left = This.Text1.Left + This.Text1.Width + 2 ENDWITH WITH This.Edit1 .Top = 5 .Left = 5 .Height = ThisForm.Text1.Top - .Top - 5 .Width = ThisForm.Width - .Left - 5 ENDWITH ENDPROC PROCEDURE Activate ThisForm.Arrange ENDPROC PROCEDURE Resize && 当拖拉缩放窗口或点击最大化/恢复按钮时重新排布控件的尺寸 ThisForm.Arrange ENDPROC PROCEDURE Destroy && 关闭窗口时释放事务循环 CLEAR EVENTS ENDPROC PROCEDURE Text1.Init This.Value = This.Parent.Edit1.FontSize ENDPROC PROCEDURE Text1.Click && 鼠标点击文本框时进入全选状态 WITH This .SelStart = 0 .SelLength = LEN(.InputMask) ENDWITH ENDPROC PROCEDURE Text1.Valid This. ENDPROC PROCEDURE Command1.Click WITH This.Parent IF .Text1.Value >= 0 .Edit1.FontSize = .Text1.Value ELSE .Text1.Value = .Edit1.FontSize ENDIF ENDWITH ENDPROC ENDDEFINE