| 网站首页 | 业界新闻 | 群组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 编程论坛
共有 2848 人关注过本帖, 3 人收藏
标题:发个字形结构的图
只看楼主 加入收藏
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25793
专家分:48814
注 册:2011-6-22
结帖率:100%
  已结贴   问题点数:20  回复次数:39   
发个字形结构的图


程序代码:

#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 ThisForm.cntHZ
            .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)
            ThisForm.cntHZ.Show_HZ(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



[ 本帖最后由 TonyDeng 于 2012-3-3 23:05 编辑 ]
搜索更多相关主题的帖子: Documents  color  
2012-03-03 21:23
软件服务
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:3
帖 子:344
专家分:736
注 册:2011-12-23
  得分:4 
2012-03-03 21:41
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25793
专家分:48814
注 册:2011-6-22
  得分:0 
回复 2楼 软件服务
啥表情哟

授人以渔,不授人以鱼。
2012-03-03 21:43
dapinetree
Rank: 2
等 级:论坛游民
帖 子:29
专家分:34
注 册:2011-9-11
  得分:4 
楼主共享一下呀!
2012-03-03 22:37
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25793
专家分:48814
注 册:2011-6-22
  得分:0 
呵呵,我把源代码补上去了。

授人以渔,不授人以鱼。
2012-03-03 22:43
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:167
帖 子:7294
专家分:17140
注 册:2012-2-5
  得分:4 
以下是引用TonyDeng在2012-3-3 22:43:50的发言:

呵呵,我把源代码补上去了。
偷工减料,藏私
你害人啊!

[ 本帖最后由 sdta 于 2012-3-3 22:56 编辑 ]

坚守VFP最后的阵地
2012-03-03 22:51
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25793
专家分:48814
注 册:2011-6-22
  得分:0 
我咋害人啦?

授人以渔,不授人以鱼。
2012-03-03 22:56
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:167
帖 子:7294
专家分:17140
注 册:2012-2-5
  得分:0 
以下是引用TonyDeng在2012-3-3 22:56:45的发言:

我咋害人啦?
不能运行,是不是害人啊

坚守VFP最后的阵地
2012-03-03 22:57
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25793
专家分:48814
注 册:2011-6-22
  得分:0 
哦,那个hzk16字库,网上到处都有下载啦。我上传到下载资源那里去,大家共享一下,反正也是人家给我的。

授人以渔,不授人以鱼。
2012-03-03 22:59
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25793
专家分:48814
注 册:2011-6-22
  得分:0 
上传好了,在1楼有连接。

授人以渔,不授人以鱼。
2012-03-03 23:06







关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.289043 second(s), 7 queries.
Copyright©2004-2018, BCCN.NET, All Rights Reserved