把你的需求详细说明看看,最好有图,希望通过怎样的手段达到什么目的。
授人以渔,不授人以鱼。
CLEAR ALL CLOSE DATABASES ALL CLEAR PUBLIC K_ESC K_ESC = 27 goForm = CREATEOBJECT("C_Form") goForm.Show() READ EVENTS CLOSE DATABASES ALL CLEAR ALL RETURN DEFINE CLASS C_Form AS Form Caption = "测试例程" MinWidth = 800 MinHeight = 600 AutoCenter = .T. KeyPreview = .T. ADD OBJECT Grid1 AS Grid WITH TabIndex = 1 ADD OBJECT Label1 AS Label WITH Caption = "系统剪贴板内容", Height = 25, AutoSize = .T. ADD OBJECT Edit1 AS EditBox WITH ReadOnly = .T. PROCEDURE Load USE test EXCLUSIVE IN 0 ENDPROC PROCEDURE Unload USE IN test ENDPROC PROCEDURE Arrange WITH ThisForm.Grid1 .Top = 5 .Left = 5 .Height = ThisForm.Height - .Top - 5 .Width = ThisForm.Width / 2 - .Left - 5 ENDWITH WITH ThisForm.Label1 .Top = 5 .Left = ThisForm.Width / 2 + 5 ENDWITH WITH ThisForm.Edit1 .Top = ThisForm.Label1.Top + ThisForm.Label1.Height + 5 .Left = ThisForm.Width / 2 + 5 .Height = ThisForm.Height - .Top - 5 .Width = ThisForm.Width - .Left - 5 ENDWITH ENDPROC PROCEDURE Activate ThisForm.Arrange ENDPROC PROCEDURE Resize ThisForm.Arrange ENDPROC PROCEDURE KeyPress(tnKeyCode, tnShiftAltCtrl) IF tnKeyCode == K_ESC RELEASE ThisForm ENDIF ENDPROC PROCEDURE Destroy CLEAR EVENTS ENDPROC PROCEDURE Grid1.Init WITH This .RecordSourceType = 1 .RecordSource = "test" .SetAll("Width", 150, "Column") ENDWITH ENDPROC PROCEDURE Grid1.AfterRowColChange(tnColumnIndex) LOCAL lnSatrt, lnLength IF tnColumnIndex == 1 lnStart = 1 lnLength = 7 This.Copy_Clipboard(test.T01, lnStart, lnLength) ELSE ThisForm.Edit1.Value = "" ENDIF ENDPROC PROCEDURE Grid1.Copy_Clipboard(tcString, tnStart, tnLength) _ClipText = SUBSTRC(tcString, tnStart, tnLength) ThisForm.Edit1.Value = "从第" + ALLTRIM(STR(tnStart)) + "个字符开始共" + ALLTRIM(STR(tnLength)) + "个字符的内容:" + _ClipText ENDPROC ENDDEFINE