?? clstext.cls
字號:
Save = Save And SetIni(FileName, section, "drawborder", CStr(drawBorder))
Save = Save And SetIni(FileName, section, "fontname", CStr(FontName))
Save = Save And SetIni(FileName, section, "fontsize", CStr(fontsize))
Save = Save And SetIni(FileName, section, "fontbold", CStr(FontBold))
Save = Save And SetIni(FileName, section, "fontitalic", CStr(FontItalic))
Save = Save And SetIni(FileName, section, "fontunderline", CStr(FontUnderLine))
Save = Save And SetIni(FileName, section, "FontStrikethru", CStr(FontStrikeThru))
Save = Save And SetIni(FileName, section, "foreColor", CStr(ForeColor))
Save = Save And SetIni(FileName, section, "autowrap", CStr(autowrap))
Save = Save And SetIni(FileName, section, "autoTrim", CStr(autoTrim))
Save = Save And SetIni(FileName, section, "width", CStr(width))
Save = Save And SetIni(FileName, section, "height", CStr(height))
Save = Save And SetIni(FileName, section, "rowheight", CStr(rowheight))
Save = Save And SetIni(FileName, section, "left", CStr(Left))
Save = Save And SetIni(FileName, section, "top", CStr(Top))
Save = Save And SetIni(FileName, section, "tag", CStr(tag))
Save = Save And SetIni(FileName, section, "orient", CStr(m_Orient))
End Function
'**************************************************************
'*名稱:Read
'*功能:從文件中讀取
'*傳入參數:
'* filename --文件名
'*返回參數:
'* 是否讀取成功
'*作者:progame
'*日期:2002-04-16 20:47:42
'***************************************************************
Public Function Read(FileName As String, section As String) As Boolean
On Error GoTo err_proc
stringX = GetIni(FileName, section, "stringx")
fieldtype = CInt(GetIni(FileName, section, "fieldtype"))
showzero = CBool(GetIni(FileName, section, "showzero"))
decimalnumber = CInt(GetIni(FileName, section, "decimalnumber"))
usesperator = CBool(GetIni(FileName, section, "usesperator"))
Align = CInt(GetIni(FileName, section, "align"))
drawBorder = CBool(GetIni(FileName, section, "drawborder"))
FontName = GetIni(FileName, section, "fontname")
fontsize = CSng(GetIni(FileName, section, "fontsize"))
FontBold = CBool(GetIni(FileName, section, "fontbold"))
FontItalic = CBool(GetIni(FileName, section, "fontitalic"))
FontUnderLine = CBool(GetIni(FileName, section, "fontunderline"))
FontStrikeThru = CBool(GetIni(FileName, section, "FontStrikethru"))
ForeColor = CLng(GetIni(FileName, section, "foreColor"))
autowrap = CBool(GetIni(FileName, section, "autowrap"))
autoTrim = CBool(GetIni(FileName, section, "autoTrim$"))
width = CSng(GetIni(FileName, section, "width"))
height = CSng(GetIni(FileName, section, "height"))
rowheight = CSng(GetIni(FileName, section, "rowheight"))
Left = CSng(GetIni(FileName, section, "left"))
Top = CSng(GetIni(FileName, section, "top"))
tag = GetIni(FileName, section, "tag")
m_Orient = CInt(GetIni(FileName, section, "orient"))
Read = True
Exit Function
err_proc:
Read = False
End Function
'**************************************************************
'*名稱:PrintIt
'*功能:輸出此字符串
'*傳入參數:
'* obj --要輸出的對象
'* sRate --縮放比例
'*返回參數:
'*
'*作者:progame
'*日期:2002-03-17 21:09:51
'***************************************************************
Public Function PrintIt(obj As Object, sRate As Single)
On Error Resume Next
'*畫邊框
If drawBorder Then
obj.DrawWidth = IIf(sRate < 1, 1, CInt(sRate))
'*只繪制右邊和底部的邊框
obj.Line (Left * sRate, (Top + height) * sRate)-Step(width * sRate, 0), vbBlack 'foreColor
obj.Line ((Left + width) * sRate, Top * sRate)-Step(0, height * sRate), vbBlack ' foreColor
End If
'*設置輸出對象的屬性
SetObj obj, sRate
Dim rows As Integer '*總用行數
rows = GetRows
'*如果高度為0,設高度為GetHeight
If height = 0 Then
height = GetHeight
End If
'*如果行高為0,設行高為height
If rowheight = 0 Then
rowheight = height
End If
'*計算真正的輸出豎向起始位置
'*(因為有時候一行的其它列占用的行比本列的要多)
Dim mTop As Single
mTop = Top
If CInt(height / rowheight) > rows Then
mTop = (height - rowheight * rows) / 2
End If
'*開始輸出了....
Dim i As Integer
Dim sWidth As Single
Dim tWidth As Single
Dim str As String
Dim tStr As String
Dim row As Integer
str = GetStr
row = 0
sWidth = MYSPACE
'*如果是數值型,必須一次全部輸出
If fieldtype = tyNumeric Then
PrintStr obj, 1, rows, str, sRate
Exit Function
End If
For i = 1 To Len(str)
tWidth = CalWidth(Mid(str, i, 1), fontsize)
If sWidth + tWidth + MYSPACE > width Then '*超出可打印寬度,新的一行
row = row + 1
If row > MAXROWS Then
Exit Function
End If
'*輸出此字符串
PrintStr obj, row, rows, tStr, sRate
If (Not autowrap) And i = 1 Then '*如果不自動換行,則只輸出一行
Exit Function
End If
sWidth = MYSPACE + tWidth
tStr = Mid(str, i, 1)
Else '*未超出寬度
sWidth = sWidth + tWidth
tStr = tStr & Mid(str, i, 1)
End If
Next i
'*輸出此字符串
PrintStr obj, row + 1, rows, tStr, sRate
End Function
'**************************************************************
'*名稱:PrintItVer
'*功能:輸出此字符串(豎向)
'*傳入參數:
'* obj --要輸出的對象
'* sRate --縮放比例
'*返回參數:
'*
'*作者:progame
'*日期:2002-04-29 21:09:51
'***************************************************************
Public Function PrintItVer(obj As Object, sRate As Single)
'
'*設置輸出對象的屬性
SetObj obj, sRate
Dim mstr As String '*當前要輸出的字符
Dim mTop As Single '*當前輸出的Y位置
Dim mWidth As Single '*當前每個字要占用的寬度(非漢字)
Dim mHeight As Single '*每個字要占用的高度
mHeight = CalHeight(fontsize)
'*根據對齊方式決定輸出的頂點位置
Select Case Align
Case tyLeft
mTop = Top
Case tymiddle
mTop = Top + (height - mHeight * Len(stringX)) / 2
Case tyRight
mTop = Top + (height - mHeight * Len(stringX))
End Select
Dim i As Integer
For i = 1 To Len(stringX)
'*輸出
mstr = Mid(stringX, i, 1)
mWidth = CalWidth(mstr, fontsize)
'*得到輸出的左位置
obj.CurrentX = (Left + (width - mWidth) / 2) * sRate
obj.CurrentY = mTop * sRate
obj.Print Mid(stringX, i, 1)
'*重新計算Y位置
mTop = mTop + mHeight
Next i
End Function
Private Sub PrintStr(obj As Object, row As Integer, rows As Integer, str As String, sRate As Single)
'*輸出此行字符串
'* obj --輸出對象
'* row --輸出行數
'* rows --總行數
'* str --輸出字符串
'* srate --縮放比例
Select Case Align
Case tyLeft '*左對齊
obj.CurrentX = Left + MYSPACE
Case tymiddle '*居中對齊
obj.CurrentX = Left + (width - CalWidth(str, fontsize)) / 2
Case tyRight '*右對齊
obj.CurrentX = Left + width - (CalWidth(str, fontsize) + MYSPACE)
End Select
obj.CurrentY = Top + (row - 1) * height / rows _
+ (height / rows - CalHeight(fontsize)) / 2
obj.CurrentX = obj.CurrentX * sRate
obj.CurrentY = obj.CurrentY * sRate
'*輸出
obj.Print str
End Sub
'**************************************************************
'*名稱:SetObj
'*功能:設置輸出對象屬性
'*傳入參數:
'* obj --輸出對象
'*作者:progame
'*日期:2002-04-29 23:45:06
'***************************************************************
Private Sub SetObj(obj As Object, sRate As Single)
On Error Resume Next
With obj
.FontName = FontName
.fontsize = fontsize * sRate
.FontBold = FontBold
.FontItalic = FontItalic
.FontUnderLine = FontUnderLine
.FontStrikeThru = FontStrikeThru
.ForeColor = ForeColor
End With
End Sub
Private Sub Class_Initialize()
'*初始化
fieldtype = tyText
Align = tyLeft
showzero = True
decimalnumber = -1
usesperator = False
FontName = "宋體"
fontsize = 9
ForeColor = vbBlack
autowrap = True
autoTrim = False
m_Orient = Landscape
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -