vb 打印
Private Sub PrintTxt(txt As String, ConWidth As Long, LeftPosition As Long)
Dim str As String
Dim str1 As String
Dim len1 As Long
str = txt
len1 = ConWidth
Do While Len(str) > 0
str1 = str
Do While len1 > 0 And Printer.TextWidth(str1) - ConWid > len1
str1 = Left(str1, Len(str1) - 1)
Loop
Printer.CurrentX = LeftPosition
Printer.Print str1 '打印
If Len(str1) = 0 Then Exit Do '不匹配
str = Mid(str, Len(str1) + 1) '截断!
Loop
End Sub
Private Sub PrintBC(prectl As Control)
Dim I As Integer
Dim str As String
Dim str1 As String
Dim len1 As Long
len1 = prectl.Width
If prectl.BorderStyle = 0 Then
ConWid = 90
Else
ConWid = -90
End If
Printer.CurrentX = prectl.Left
Printer.CurrentY = prectl.Top
Printer.Font.Name = prectl.Font.Name
Printer.Font.Size = prectl.Font.Size
'Printer.ForeColor = prectl.ForeColor
str = prectl
For I = 1 To Len(str)
If I > Len(str) Then Exit For
If Asc(Mid(str, I, 1)) = 13 Then
 
相关文档:
VB中 Replace 函数
描述
返回字符串,其中指定数目的某子字符串被替换为另一个子字符串。
语法
Replace(expression, find, replacewith[, compare[, count[, start]]])
Replace 函数的语法有以下参数:
参数 描述
expression 必选。字符串表达式,包含要替换的子字符串。
find 必选。被搜索的子字符串。
......
通过调用CreateDataSetfromXml取得XML数据
Imports System.Xml
Public Const FILE_CONFIG = "MZZ.xml"
Public Const PATH_CONFIG = "\XML\"
Dim dstXML As DataSet
Dim tblXML_DB As DataTable
Dim dtCod As New DataTable
Dim strSQL As String = ""
clsPublic ......
这段时间在移植项目的过程中,起初我想判断一个字符串中是否存在某字符(串),直接的使用方法是用instr(start,string1,string2,VB compare),但经过分析在VB中可以只用一下方法来判断!
1.常用的INStr方法
Function InStr([Start], [String1], [String2], [Compare A ......
VB显示透明FLASH效果
演示效果:
代码如下:
公共声明区域
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetW ......
主窗体代码:
'打开网页
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'复制文件
Private Declare Fu ......