icePubDLL应用系列

 
  • 调用几个api函数即可完成文字转图片,再图片转换文本图案功能,简单省事。
  • VB具体步骤:

    界面布局设计
  • 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
  • 具体代码:
    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 文本内容
      输出:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值