以下是引用cxzbzgz在2012-10-21 23:49:35的发言:
用纯代码编写似乎无法复制,用表单设计是可以复制的!
提取输入内容,等同于复制输出内容。用纯代码编写似乎无法复制,用表单设计是可以复制的!
[ 本帖最后由 bccn201203 于 2012-10-22 00:14 编辑 ]
#DEFINE CR_LF CHR(13)+CHR(10) #DEFINE WHITE RGB(255,255,255) #DEFINE BLACK RGB(0,0,0) #DEFINE GRAY RGB(192,192,192) #DEFINE DARKGRAY RGB(128,128,128) #DEFINE RED RGB(255,0,0) #DEFINE DARKRED RGB(128,0,0) #DEFINE YELLOW RGB(255,255,0) #DEFINE DARKYELLOW RGB(128,128,0) #DEFINE GREEN RGB(0,255,0) #DEFINE DARKGREEN RGB(0,128,0) #DEFINE CYAN RGB(0,255,255) #DEFINE DARKCYAN RGB(0,128,128) #DEFINE BLUE RGB(0,0,255) #DEFINE DARKBLUE RGB(0,0,128) #DEFINE MAGENTA RGB(255,0,255) #DEFINE DARKMAGENTA RGB(128,0,128) CLEAR ALL Main() RETURN PROCEDURE Main() LOCAL loForm loForm = NEWOBJECT("CForm") loForm.Show READ EVENTS ENDPROC DEFINE CLASS CForm AS Form Caption = "" BorderStyle = 1 Width = 600 Height = 400 AutoCenter = .T. ADD OBJECT PROTECTED Edit1 AS EditBox WITH FontSize = 12, Value = "" ADD OBJECT PROTECTED Container1 AS Container PROCEDURE Arrange WITH ThisForm.Edit1 .Top = 5 .Left = 5 .Width = ThisForm.Width - .Left - 5 .Height = 200 ENDWITH WITH ThisForm.Container1 .Top = ThisForm.Edit1.Top + ThisForm.Edit1.Height + 5 .Left = 5 .Width = ThisForm.Width - .Left - 5 .Height = ThisForm.Height - .Top - 5 ENDWITH ENDPROC PROCEDURE Edit1.InteractiveChange ThisForm.Container1.Refresh ENDPROC PROCEDURE Container1.Init WITH This .SpecialEffect = 1 .AddProperty("aLabels[1]") ENDWITH ENDPROC PROCEDURE Container1.Clear WITH This DO WHILE .ControlCount > 0 .RemoveObject(.Controls(.ControlCount).Name) ENDDO ENDWITH ENDPROC PROCEDURE Container1.Refresh LOCAL lcText, lnIndex, lnRow, lnCount LOCAL lcCharacter lcText = ThisForm.Edit1.Value IF !EMPTY(lcText) WITH This .Clear DIMENSION .aLabels[LENC(lcText)] lnRow = 0 lnCount = 0 FOR lnIndex = 1 TO LENC(lcText) IF SUBSTRC(lcText, lnIndex, 2) != CR_LF .AddObject(".aLabels[" + TRANSFORM(lnIndex) + "]", "Label") WITH .aLabels[lnIndex] .Caption = SUBSTRC(lcText, lnIndex, 1) .FontName = "隶书" .FontSize = 20 .Width = 30 .Height = 30 .Top = 5 + lnRow * (.Height + 10) .Left = 5 + lnCount * .Width .Visible = .T. ENDWITH lnCount = lnCount + 1 ELSE lnRow = lnRow + 1 lnCount = 0 lnIndex = lnIndex + 1 ENDIF NEXT lcText = STRTRAN(lcText, CR_LF, "") FOR lnIndex = 1 TO LENC(lcText) lcCharacter = SUBSTRC(lcText, lnIndex, 1) IF ATC(lcCharacter, lcText, 2) != 0 WITH .Controls(lnIndex) .BackColor = MAGENTA .ForeColor = YELLOW ENDWITH ENDIF NEXT ENDWITH ENDIF ENDPROC PROCEDURE Activate ThisForm.Arrange ENDPROC PROCEDURE Destroy CLEAR EVENTS ENDPROC ENDDEFINE