发个字形结构的图
" border="0" />程序代码:
#INCLUDE "C:\My Documents\Visual FoxPro Projects\my_tools\Const.h" CLEAR ALL oForm = CREATEOBJECT("_Form") oForm.Show READ EVENTS RETURN DEFINE CLASS _Form AS Form Caption = "HZK16 Demo" Width = 240 Height = 240 ControlBox = .F. BorderStyle = 1 AutoCenter = .T. zk = 0 ADD OBJECT lblChar AS Label WITH Caption = "汉字:", Width = 60, Height = 25, Alignment = 1 ADD OBJECT txtChar AS TextBox WITH Width = 40, Height = 25 ADD OBJECT cntHZ AS _HZ ADD OBJECT cmdExit AS CommandButton WITH Caption = "结束[\<E]", Width = 60, Height = 25 PROCEDURE Arrange WITH ThisForm.lblChar .Top = 10 .Left = 10 ENDWITH WITH ThisForm.txtChar .Top = ThisForm.lblChar.Top .Left = ThisForm.lblChar.Left + ThisForm.lblChar.Width ENDWITH WITH Top = ThisForm.lblChar.Top + ThisForm.lblChar.Height + 5 .Left = ThisForm.lblChar.Left ENDWITH WITH ThisForm.cmdExit .Top = ThisForm.Height - .Height - 5 .Left = 5 ENDWITH ENDPROC PROCEDURE Load ThisForm.zk = FOPEN("HZK16V") ENDPROC PROCEDURE Unload FCLOSE(ThisForm.zk) ENDPROC PROCEDURE Activate ThisForm.Arrange ENDPROC PROCEDURE Destroy CLEAR EVENTS ENDPROC PROCEDURE txtChar.KeyPress(tnKeyCode, tnShiftAltCtrl) LOCAL lnQu, lnWei IF (tnKeyCode == K_ENTER) .AND. !EMPTY(This.Value) This.Value = LEFTC(ALLTRIM(This.Value), 1) lnQu = ASC(LEFT(This.Value, 1)) - 0xA0 lnWei = ASC(RIGHT(This.Value, 1)) - 0xA0 FSEEK(ThisForm.zk, ((lnQu - 1) * 94 + (lnWei - 1)) * 32, 0) (FREAD(ThisForm.zk, 32)) ENDIF ENDPROC PROCEDURE cmdExit.Click ThisForm.Release ENDPROC ENDDEFINE DEFINE CLASS _HZ AS Container PROCEDURE Init LOCAL lnRow, lnCol, lnWidth, lnHeight, lcName lnWidth = 10 lnHeight = 10 WITH This .Width = lnWidth * 16 .Height = lnHeight * 16 FOR lnRow = 1 TO 16 FOR lnCol = 1 TO 16 lcName = "Dot" + PADL(lnRow, 2, '0') + PADL(lnCol, 2, '0') .AddObject(lcName, "Label") WITH .&lcName *.Caption = SUBSTR(.Name,4) .Caption = "" .BorderStyle = 1 .Width = lnWidth .Height = lnHeight .Top = (lnRow - 1) * lnHeight .Left = (lnCol - 1) * lnWidth .Visible = .T. ENDWITH NEXT NEXT ENDWITH ENDPROC PROCEDURE Show_HZ(tcData) LOCAL lnIndex, lnRow, lnCol, lnCompare, lnName, lcByte, lnBit lnRow = 1 lnCol = 1 FOR lnIndex = 1 TO LEN(tcData) lcByte = SUBSTR(tcData, lnIndex, 1) FOR lnBit = 7 TO 0 STEP -1 lcName = "This.Dot" + PADL(lnRow, 2, '0') + PADL(lnCol, 2, '0') lnCompare = INT(2^lnBit) &lcName..BackColor = IIF(BITAND(ASC(lcByte), lnCompare) == lnCompare, BLUE, This.BackColor) lnCol = lnCol + 1 NEXT IF MOD(lnIndex, 2) == 0 lnRow = lnRow + 1 lnCol = 1 ENDIF NEXT ENDPROC ENDDEFINE
字库下载:https://down.bccn.net/2086.html
" border="0" />
[ 本帖最后由 TonyDeng 于 2012-3-3 23:05 编辑 ]