📄 form1.frm
字号:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "密度转换"
ClientHeight = 2715
ClientLeft = 45
ClientTop = 330
ClientWidth = 4755
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2715
ScaleWidth = 4755
StartUpPosition = 2 '屏幕中心
Begin RichTextLib.RichTextBox r2
Height = 1575
Left = 960
TabIndex = 11
Top = 3720
Visible = 0 'False
Width = 2535
_ExtentX = 4471
_ExtentY = 2778
_Version = 393217
Enabled = -1 'True
TextRTF = $"Form1.frx":0000
End
Begin RichTextLib.RichTextBox r1
Height = 615
Left = 3000
TabIndex = 10
Top = 2640
Visible = 0 'False
Width = 855
_ExtentX = 1508
_ExtentY = 1085
_Version = 393217
TextRTF = $"Form1.frx":009D
End
Begin VB.TextBox Text5
Height = 615
Left = 960
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 9
Top = 2640
Visible = 0 'False
Width = 1695
End
Begin VB.CommandButton Command2
Caption = "设置默认"
Height = 495
Left = 2760
TabIndex = 8
Top = 1920
Width = 1215
End
Begin VB.TextBox Text4
Height = 375
Left = 2880
TabIndex = 6
Text = "1.45"
Top = 1320
Width = 975
End
Begin VB.TextBox Text3
Height = 375
Left = 1440
TabIndex = 5
Text = "1.00"
Top = 1320
Width = 855
End
Begin VB.CommandButton Command1
Caption = "修 改"
Height = 495
Left = 840
TabIndex = 2
Top = 1920
Width = 1215
End
Begin VB.TextBox Text2
Height = 270
Left = 1440
TabIndex = 1
Text = "0020"
Top = 840
Width = 2655
End
Begin VB.TextBox Text1
Height = 270
Left = 1440
TabIndex = 0
Text = "c:/xbz/0020"
Top = 360
Width = 2655
End
Begin VB.Line Line1
X1 = 2400
X2 = 2760
Y1 = 1560
Y2 = 1560
End
Begin VB.Label Label3
Caption = "范围值:"
Height = 375
Left = 360
TabIndex = 7
Top = 1440
Width = 735
End
Begin VB.Label Label2
Caption = "工程代号:"
Height = 255
Left = 360
TabIndex = 4
Top = 840
Width = 975
End
Begin VB.Label Label1
Caption = "工程位置:"
Height = 255
Left = 360
TabIndex = 3
Top = 360
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sz(2000) As Integer
Dim str1 As String
Private Sub Command1_Click()
Dim fs As New FileSystemObject
'′利用filesystemobject对象的fileexists
'方法判断文件是否存在
If fs.fileExists(Text1.Text & "/tgmdsj." & Text2.Text) Then
r1.FileName = Text1.Text & "/tgmdsj." & Text2.Text
'Text5.Text = r1.Text
str1 = r1.Text
str2 = ""
Do While str1 <> ""
str2 = str2 & Mid(str1, 1, 13)
str1 = Mid(str1, 14)
str3 = (Mid(str1, 1, InStr(1, str1, Chr(10), vbTextCompare) - 2))
If str3 > (Text3.Text) And str3 < (Text4.Text) Then
str3 = Format(str3 / 0.6, "####0.00")
End If
str1 = Mid(str1, InStr(1, str1, Chr(10), vbTextCompare) + 1)
str2 = str2 & str3 & Chr(13) & Chr(10)
Loop
r1.Text = str2
r1.SaveFile Text1.Text & "/tgmdsj." & Text2.Text, rtfText
MsgBox "修改成功!"
Else
MsgBox "工程位置或代号不正确"
End If
Set fs = Nothing
End Sub
Private Sub Command2_Click()
r2.Text = Text1.Text & Chr(13) & Chr(10)
r2.Text = r2.Text + Text2.Text & Chr(13) & Chr(10)
r2.Text = r2.Text + Text3.Text & Chr(13) & Chr(10)
r2.Text = r2.Text + Text4.Text & Chr(13) & Chr(10)
r2.SaveFile App.Path & "/set.txt", rtfText
End Sub
Private Sub Form_Load()
Dim fs As New FileSystemObject
If fs.fileExists(App.Path & "\set.txt") Then
r2.FileName = App.Path & "\set.txt"
Text1.Text = Mid(r2.Text, 1, InStr(1, r2.Text, Chr(13)) - 1)
r2.Text = Mid(r2.Text, InStr(1, r2.Text, Chr(10)) + 1)
Text2.Text = Mid(r2.Text, 1, InStr(1, r2.Text, Chr(13)) - 1)
r2.Text = Mid(r2.Text, InStr(1, r2.Text, Chr(10)) + 1)
Text3.Text = Mid(r2.Text, 1, InStr(1, r2.Text, Chr(13)) - 1)
r2.Text = Mid(r2.Text, InStr(1, r2.Text, Chr(10)) + 1)
Text4.Text = Mid(r2.Text, 1, InStr(1, r2.Text, Chr(13)) - 1)
End If
Set fs = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -