改进 Windows 附件的功能

小白兔 2003-07-17 01:58:53
我最近想要提高 Windows 附件的功能,以改变某些附件实在不理想的弊病,而且要是去购买其他软件又要花钱,我想这些都是这里的高手们的小菜吧。我不是高手,很想学习一下大家都是怎么改进的,或者直接自己编写一个新的(写个 Word 能省下多少钱呀,呵呵,开玩笑)。希望能得到大家的帮助。例如,计算器应该有个计算过程的记录,把计算出的量起名,记录在某个文件中以便以后查询,等等吧。。。大家各抒己见吧。
...全文
32 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
nebbish 2003-07-18
  • 打赏
  • 举报
回复
上面是个计算器
小白兔 2003-07-18
  • 打赏
  • 举报
回复
没有人支持吗?自己顶一下……
小白兔 2003-07-17
  • 打赏
  • 举报
回复
也不讲解一下,程序是干吗的?
csdngoodnight 2003-07-17
  • 打赏
  • 举报
回复
Private Sub Command7_Click(Index As Integer)
Select Case Index
Case 0
memo = memo + Val(Text1.Text)
Case 1
memo = memo - Val(Text1.Text)
Case 2
memo = memo * Val(Text1.Text)
Case 3
If Val(Text1.Text) <> 0 Then
memo = memo / Val(Text1.Text)
Else
MsgBox ("ILLEGAL. DIVIDE 0 ERROR ")
End If
Case 4
Text1.Text = Str(memo)
prev = Val(Text1.Text)
Case 5
memo = 0
End Select
End Sub

Private Sub Command8_Click(Index As Integer)
Select Case Index
Case 0
que(qt) = Val(Text1.Text)
qt = qt + 1
Case 1
qv = qnext(qv)
Label1.Caption = Str(que(qv))
' qv = qnext(qv)
Case 2
On Error GoTo anil
que(qv) = que(qt - 1)
Label1.Caption = Str(que(qv))
qt = qt - 1

Case 3
Text1.Text = Label1.Caption
End Select
anil:

End Sub

Private Sub Command9_Click(Index As Integer)
Select Case Index
Case 0
Text1.Text = Str(Rnd)
Case 1
Text1.Text = 3.141592654
Case 2
Text1.Text = 2.718281828
Case 3
Text1.Text = 9.86
Case 4
Text1.Text = "6.625"
End Select
opnre = 0
' If oflag = 0 Then
' Text1.Text = " "
' End If
oflag = 1
End Sub


'Private Sub Command4_Click()
' dflag = 0
' prev = 0
' oflag = 0
' ind = 0
' opnre = 0
' Text1.Text = " 0"

'End Sub

'Private Sub Command5_Click()
' Unload Me
' End
'End Sub

Private Sub ecopy_Click()
Clipboard.Clear
Clipboard.SetText Text1.SelText

End Sub

Private Sub ecut_Click()
Clipboard.Clear
Clipboard.SetText Text1.SelText
Text1.SelText = ""

End Sub

Private Sub eexit_Click()
Unload Me

End Sub

Private Sub epaste_Click()
Text1.Text = ""
Text1.SelText = Clipboard.GetText()
End Sub

Private Sub eselectall_Click()
Clipboard.Clear
Clipboard.SetText Text1.Text
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = Asc(".") Then
i = 10
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("0") Then
i = 0
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("1") Then
i = 1
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("2") Then
i = 2
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("3") Then
i = 3
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("4") Then
i = 4
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("5") Then
i = 5
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("6") Then
i = 6
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("7") Then
i = 7
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("8") Then
i = 8
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("9") Then
i = 9
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("0") Then
i = 0
Command1_Click (i)
Beep
ElseIf KeyAscii = Asc("+") Then
i = 0
Command2_Click (i)
Beep
ElseIf KeyAscii = Asc("+") Then
i = 0
Command2_Click (i)
Beep
ElseIf KeyAscii = Asc("-") Then
i = 1
Command2_Click (i)
Beep
ElseIf KeyAscii = Asc("/") Then
i = 2
Command2_Click (i)
Beep

ElseIf KeyAscii = Asc("*") Then
i = 3
Command2_Click (i)
Beep
ElseIf KeyAscii = Asc("=") Then
i = 4
Command2_Click (i)
Beep
ElseIf KeyAscii = Asc("c") Or KeyAscii = Asc("C") Then
dflag = 0
prev = 0
oflag = 0
ind = 0
opnre = 0
Text1.Text = " 0"
Beep
Beep
ElseIf KeyAscii = Asc("d") Or KeyAscii = Asc("D") Then
Text1.Text = " 0"
Beep
End If
End Sub

Private Sub Form_Load()
scientific.Width = 6540
scientific.Height = 4735
memo = 0
dflag = 0
prev = 0
oflag = 0
ind = 0
opnre = 0
qh = 0
qt = 0
Clipboard.Clear
Option2(0).Value = True
ang = 3.14 / 180
End Sub

Private Sub habout_Click()
nachelp.Show
End Sub

Private Sub hcontents_Click()
naccalc.Show

End Sub

Private Sub Option2_Click(Index As Integer)
Select Case Index
Case 0
ang = 3.141592654 / 180
Case 1
ang = 1
Case 2
ang = 3.141592654 / 200
End Select
End Sub

Private Sub Option3_Click()
standard.Show
scientific.Hide
scientific.Option3.Value = False


End Sub




Private Sub Text1_Change()
Label2.Caption = Text1.Text

End Sub

Private Sub tscientific_Click()
scientific.Show
standard.Hide

End Sub

Private Sub tstandard_Click()
standard.Show
scientific.Hide
End Sub



csdngoodnight 2003-07-17
  • 打赏
  • 举报
回复
Dim que(25) As Double
Public qt As Integer
Public qh As Integer
Public qv As Integer
Public ang As Double

Public memo As Double
Dim dflag As Integer
Dim i As Integer
Dim opnre As Integer
Dim prev As Double
Dim oflag As Integer
Dim ind As Integer
Private Sub Command1_Click(Index As Integer)
If ind = 4 Then
prev = 0
Text1.Text = " "
ind = 0
End If
opnre = 0 ' conform operand
If oflag = 0 Then ' if previous operator clear text
Text1.Text = " "
End If
oflag = 1
If Command1(Index).Caption <> "." Then
If Text1.Text <> " 0" Then
Text1.Text = Text1.Text & Command1(Index).Caption
Else
Text1.Text = " " & Command1(Index).Caption
End If
Else
If dflag = 0 Then
Text1.Text = Text1.Text & "."
dflag = 1
Else
MsgBox ("ILLEGAL SAIRAM")
End If
End If


End Sub

Private Sub Command10_Click(Index As Integer)
If Index = 2 Then
If Val(Text1.Text) < 700 Then
Text1.Text = Str(Exp(Val(Text1.Text)))
Else
MsgBox (" OVERFLOW. VALUE TOO BIG ")
End If
ElseIf Index = 0 Then
If Val(Text1.Text) > 0 Then
Text1.Text = Str(Log(Val(Text1.Text)))
Else
MsgBox (" ILLEGAL. LOG NON POSITIVE ")
End If
ElseIf Index = 1 Then
If Val(Text1.Text) > 0 Then
Text1.Text = Str((Log(Val(Text1.Text)) / Log(10)))
Else
MsgBox (" ILLEGAL. LOG NON POSITIVE ")
End If

End If
End Sub

Private Sub Command11_Click()
If (Text1.Text <> "") Then
Text1.Text = Mid(Text1.Text, 1, Len(Text1.Text) - 1)
End If
End Sub

Private Sub Command13_Click()
Unload Me
End Sub

Private Sub Command14_Click()
Text1.Text = Str(Val(Text1.Text) * -1)
End Sub
Function qnext(p As Integer) As Integer
On Error Resume Next
qnext = (p + 1) Mod qt
End Function

Function power(x As Double, Y As Long) As Double
Dim i As Double
i = 1
If (Y > 0) Then
While Y > 0
Y = Y - 1
i = i * x
Wend
power = i
ElseIf (Y = 0) Then
power = 1
Else
MsgBox ("ILLEGAL. POWER LESTHAN 0.")
End If
End Function
Function fact(num As Long) As Long
If (num < 0 Or num = 0) Then
MsgBox ("ILLEGAL NEAGETIVE FACTORIAL")
fact = num
Else
If (num > 12) Then
MsgBox ("VALUE TOO LARGE")
fact = num
Else
re = 1
While (num > 0)
re = re * num
num = num - 1
Wend
fact = re
End If
End If

End Function
Private Sub Command2_Click(Index As Integer)
Dim n As Long
Dim r As Long
If opnre = 0 Or Index = 4 Then
If ind = 0 Then
prev = prev + Val(Text1.Text)
ElseIf ind = 1 Then
prev = prev - Val(Text1.Text)
ElseIf ind = 6 Then
prev = prev Mod Val(Text1.Text)
ElseIf ind = 7 Then
r = Fix(Val(Text1.Text))
n = Fix(Val(prev))
If ((n > r Or n = r) And n > 0 And (r > 0 Or r = 0)) Then
prev = fact(n) / (fact(n - r))
Else
MsgBox ("ILLEGAL ENTRIES of N ,R ")
End If

ElseIf ind = 5 Then
r = Fix(Val(Text1.Text))
n = Fix(Val(prev))
If ((n > r Or n = r) And n > 0 And (r > 0 Or r = 0)) Then
prev = fact(n) / (fact(n - r) * fact(r))
Else
MsgBox ("ILLEGAL ENTRIES of N ,R ")
End If
ElseIf ind = 8 Then
If (Text1.Text = "" Or prev = 0) Then
MsgBox ("ILLEGAL. INVALIED ENTRIES")
Else
prev = (power(prev, Fix(Val(Text1.Text))))

End If

ElseIf ind = 2 Then
If Val(Text1.Text) <> 0 Then
prev = prev / Val(Text1.Text)
Else
MsgBox (" ILLEGAL DIVIDE 0 ")
End If
ElseIf ind = 3 Then
prev = prev * Val(Text1.Text)
End If
Text1.Text = Str(prev)
oflag = 0 ' operator or operand
End If
opnre = 1 ' multiple operators flag
ind = Index
dflag = 0
End Sub

Private Sub Command3_Click(Index As Integer)
Text1.Text = " 0"
End Sub

Private Sub Command4_Click(Index As Integer)
memo = 0
dflag = 0
prev = 0
oflag = 0
ind = 0
opnre = 0
qh = 0
qt = 0
Clipboard.Clear
Text1.Text = " 0"
End Sub

Private Sub Command5_Click(Index As Integer)
Select Case Index
Case 0
Text1.Text = Str(Sin(ang * Val(Text1.Text)))
Case 1
Text1.Text = Str(Cos(ang * Val(Text1.Text)))
Case 2
If (Cos(Val(Text1.Text))) <> 0 Then
Text1.Text = Str(Sin(ang * Val(Text1.Text)) / Cos(ang * Val(Text1.Text)))
Else
MsgBox ("ILLEGAL. DIVIDE BY ZERO ")
End If
Case 5
Text1.Text = Str((Atn(Val(Text1.Text))) / ang)
End Select
End Sub

Private Sub Command6_Click(Index As Integer)
Dim re As Long
Dim temp As Long

temp = Val(scientific.Text1.Text)
Select Case Index
Case 2
' temp = Val(Text1.Text)
If temp > 0 Or temp = 0 Then
scientific.Text1.Text = Str(Sqr(Val(Text1.Text)))
Else
MsgBox (" ILLEGAL ATTEMPTING NEGETIVE ROOT")
End If

Case 0
temp = Val(Text1.Text)
If temp <> 0 Then
scientific.Text1.Text = Str(1 / temp)
Else
MsgBox (" ILLEGAL DIVIDE 0 ")

End If
Case 1
If Abs(Val(Text1.Text)) < 46300 Then
scientific.Text1.Text = Str((temp * temp))
Else
MsgBox (" ILLEGAL DIVIDE 0 ")
End If
Case 8
If Abs(Val(Text1.Text)) < 1290 Then
scientific.Text1.Text = Str(temp * temp * temp)
Else
MsgBox ("OVERFLOW. VALUE TOO LARGE ")
End If
Case 4
Text1.Text = Str(fact(Val(Text1.Text)))
End Select



End Sub

16,721

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧