icePubDll应用.生成文字的文本图案(字符填充)

2012-08-20 23:07:50  阅读 4628 次 评论 0 条

工具/原料

  • windows os;vc6/vb6;icePubDll.dll;

步骤/方法

  1. VB具体步骤:
    界面布局设计
     
    icePubDll应用.生成文字的文本图案(字符填充)
  2. API声明:
    Private Declare Function icePub_imgToFileTextImg Lib "icePubDll.dll" (ByVal strImgFilename As String, ByVal strFilename As String, ByVal strFenge As String, ByVal ch As Byte) As Integer
    Private Declare Function icePub_createWordBmpFile Lib "icePubDll.dll" (ByVal strWord As String, ByVal strBmpFilename As String, ByVal bmpWidth As Integer, ByVal bmpHeight As Integer) As Integer
    Private Declare Function icePub_readFileToText Lib "icePubDll.dll" (ByVal strFilename As String, ByVal strText As String, ByVal maxLen As Integer) As Integer
    Private Declare Function icePub_toClipboard Lib "icePubDll.dll" (ByVal strBuffer As String) As Integer
  3. 具体代码:
    Private Sub Command1_Click()'生成按钮代码
    Dim a2 As Long
    Dim ch As Byte
    Dim strText As String
    Dim x() As Byte

    'Text1 待处理文字文本框值
    'Text2 生成文本图案文本框值

    'Text3 待填充字符文本框值


    If Len(Text1.Text) < 0 Then
    MsgBox "输入文字不要为空~"
    Exit Sub
    End If


    ch = Asc("*")
    x = StrConv(Text3.Text, vbFromUnicode)
    If UBound(x) >= 0 Then
    ch = x(0)
    End If


    If ch > 100 Then
    MsgBox "填充字符要西文~"
    Exit Sub
    End If


    a2 = icePub_createWordBmpFile(Text1.Text, App.Path + "\word.bmp", 16 * Len(Text1.Text), 16)
    a2 = icePub_imgToFileTextImg(App.Path + "\word.bmp", App.Path + "\txtimg.txt", "", ch)
    strText = Space(1024 * 10 + 1)
    a2 = icePub_readFileToText(App.Path + "\txtimg.txt", strText, 1024 * 10)
    Text2.Text = strText


    End Sub


    Private Sub Command2_Click()'退出按钮代码
    Unload Me
    End Sub
     

    Private Sub Command3_Click()'复制到剪切板代码
    Dim a2 As Integer
    a2 = icePub_toClipboard(Text2.Text)
    End Sub
     

    Private Sub Form_Load()
    ChDrive App.Path
    ChDir App.Path
    End Sub
     

注意事项

  • 函数原型:
    原型:
    int WINAPI icePub_createWordBmpFile(char *strWord,char *strBmpFilename,int bmpWidth,int bmpHeight)
    输入:strWord 文本串
    strBmpFilename 待生成BMP图片文件名
    bmpWidth BMP文件宽度
    bmpHeight BMP文件高度
    输出:
     
  • 函数原型:
    原型:
    int WINAPI icePub_imgToFileTextImg(char *strImgFilename,char *strTextFilename,char *strFenge,char ch)
    输入:strImgFilename 待处理图像文件 (会被强制2值化)
    strTextFilename 待生成文本图案文件名
    strFenge 列之间分隔符
    ch 文本图案填充字符
    输出:
  • 函数原型:
    原型:
    int WINAPI icePub_readFileToText(char *strFilename,char *strText,int maxLen)
    输入:strFilename 待读取数据文件名
    strText 待写入文本串
    maxLen strText最大长度
    输出:
     
  • 函数原型:
    原型:
    int WINAPI icePub_toClipboard(char *strBuffer)
    输入:strBuffer 文本内容
    输出:
     
本文地址:http://financialos.cn/?id=64
免责声明:本文为原创文章,版权归 jinesc 所有,欢迎分享本文,转载请保留出处!

发表评论


表情

还没有留言,还不快点抢沙发?