Private Sub wenjianjia(ByVal pathstr As String)
Dim i As String
i = Dir(pathstr, vbDirectory) '取第一个
Do While i <> "" '不为空就循环
If i <> "" And i <> "" Then '如果不是 当前目录及上一级目录 及
If (GetAttr(pathstr & i) And vbDirectory) = vbDirectory Then '是否是目录
List1AddItem i '确定是目录,添加到列表,这里可以自己处理
End If
End If
i = Dir '取下一个
Loop
End Sub
Private Sub Command1_Click()
List1Clear
Call wenjianjia(AppPath + "\")
End Sub
Private Sub List1_Click()
File1Path = AppPath + "\" + List1Text + "\"
End Sub
Private Sub Command1_Click()
If Option1Value = True Then
Text2 = Sin(Val(Text1))
End If
If Option2Value = True Then
Text2 = Exp(Val(Text1))
End If
If Option3Value = True Then
Text2 = Sqr(Val(Text1))
End If
If Check1Value = 1 Then
Text2FontBold = True
End If
If Check2Value = 1 Then
Text2FontItalic = True
End If
End Sub
Private Sub Form_Load()
Label1Caption = "参数"
Label2Caption = "结果"
Command1Caption = "计算"
Frame1Caption = ""
Frame2Caption = ""
Option1Caption = "sin"
Option2Caption = "exp"
Option3Caption = "sqr"
Check1Caption = "粗体"
Check2Caption = "斜体"
Text1 = 4
Text2 = ""
Text2BackColor = &H80000006
Text2BorderStyle = 0
Text2FontSize = 20
Option3Value = True
End Sub
private sub Form_Load()lable1backcolor = vbblack
lable1forecolor = vbwhite
label1caption = "世界真奇妙"
end sub
private sub red_click()
label1forecolor = vbred
end sub
private sub yellow_click()
label1forecolor = vbyellow
end sub
private sub end_click()
end
end sub
还原的代码就是Load里面的代码,不写了,手机写不方便保存下面的代码到一个后缀名为FRM的文件中,再用VB打开即可。
===============
VERSION 500
Begin VBForm Form1
Caption = "人民币转换工具"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VBOptionButton Option1
Caption = "转换成欧元"
Height = 495
Index = 3
Left = 1680
TabIndex = 4
Top = 1200
Width = 1335
End
Begin VBOptionButton Option1
Caption = "转换成日元"
Height = 495
Index = 2
Left = 240
TabIndex = 3
Top = 1200
Width = 1215
End
Begin VBOptionButton Option1
Caption = $"Form2frx":0000
Height = 495
Index = 1
Left = 1680
TabIndex = 2
Top = 720
Width = 1335
End
Begin VBOptionButton Option1
Caption = "转换成美元"
Height = 495
Index = 0
Left = 240
TabIndex = 1
Top = 720
Width = 1215
End
Begin VBTextBox Text1
Height = 375
Left = 240
TabIndex = 0
Top = 120
Width = 1455
End
Begin VBLabel Label1
Height = 375
Left = 480
TabIndex = 5
Top = 1800
Width = 3015
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Option1_Click(Index As Integer)
Dim t As Single
t = Val(Text1Text)
Label1Caption = FormatNumber(Choose(Index + 1, t / 77, t / 1547, t / 0081, t / 108), , vbTrue)
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)