如何用得到键盘的反馈?

ssht968 2003-10-02 12:59:16
我想写个计算器,并且在输入 *,+,-,\等键盘命令时,可以得到反馈?

我设计了一个label ,如果我在label上输入*,+,-\等命令时,可以进行运算??

谢谢。
...全文
157 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
goodname008 2003-10-06
  • 打赏
  • 举报
回复
' 把Form的KeyPreview属性设成True。

Option Explicit

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Debug.Print KeyCode
End Sub

Private Sub Form_Load()
Me.KeyPreview = True
End Sub
ssht968 2003-10-06
  • 打赏
  • 举报
回复
谢谢,还是由我自己来吧.
最后一个问题,怎么知道键盘码 KeyCode

在VB中立即窗口中怎样的命令能知道/...???

谢谢,回答后马上节贴.谢谢你朋友
goodname008 2003-10-04
  • 打赏
  • 举报
回复
这么贴过来还是不行,应该还缺个.frx文件,楼主能打包后发给我吗?我帮你调试。
我的邮箱:goodname008@163.com
ssht968 2003-10-04
  • 打赏
  • 举报
回复
Begin VB.Shape Shape
FillColor = &H00FFFFFF&
FillStyle = 0 'Solid
Height = 615
Index = 0
Left = 1920
Shape = 2 'Oval
Top = 2880
Width = 975
End
Begin VB.Shape Shape
FillColor = &H00FFFFFF&
FillStyle = 0 'Solid
Height = 615
Index = 1
Left = 0
Shape = 2 'Oval
Top = 2280
Width = 975
End
Begin VB.Shape Shape
FillColor = &H00FFFFFF&
FillStyle = 0 'Solid
Height = 615
Index = 2
Left = 960
Shape = 2 'Oval
Top = 2280
Width = 975
End
Begin VB.Shape Shape
FillColor = &H00FFFFFF&
FillStyle = 0 'Solid
Height = 615
Index = 3
Left = 1920
Shape = 2 'Oval
Top = 2280
Width = 975
End
Begin VB.Shape Shape
FillColor = &H00FFFFFF&
FillStyle = 0 'Solid
Height = 615
Index = 4
Left = 0
Shape = 2 'Oval
Top = 1680
Width = 975
End
Begin VB.Shape Shape
FillColor = &H00FFFFFF&
FillStyle = 0 'Solid
Height = 615
Index = 5
Left = 960
Shape = 2 'Oval
Top = 1680
Width = 975
End
Begin VB.Shape Shape
FillColor = &H00FFFFFF&
FillStyle = 0 'Solid
Height = 615
Index = 6
Left = 1920
Shape = 2 'Oval
Top = 1680
Width = 975
End
Begin VB.Shape Shape
BackStyle = 1 'Opaque
FillColor = &H00FFFFFF&
FillStyle = 0 'Solid
Height = 615
Index = 7
Left = 0
Shape = 2 'Oval
Top = 1080
Width = 975
End
Begin VB.Shape Shape
FillColor = &H00FFFFFF&
FillStyle = 0 'Solid
Height = 615
Index = 8
Left = 960
Shape = 2 'Oval
Top = 1080
Width = 975
End
Begin VB.Shape Shape
FillColor = &H00FFFFFF&
FillStyle = 0 'Solid
Height = 615
Index = 9
Left = 1920
Shape = 2 'Oval
Top = 1080
Width = 975
End
Begin VB.Menu Edit
Caption = "编辑"
WindowList = -1 'True
Begin VB.Menu Copy
Caption = "复制"
Shortcut = ^C
End
Begin VB.Menu Gule
Caption = "粘贴"
Shortcut = ^V
End
End
Begin VB.Menu help
Caption = "帮助"
Begin VB.Menu HelpTitle
Caption = "帮助主题"
End
Begin VB.Menu AboutTitle
Caption = "关于主题"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim obtain As Double ' It used command of value 0...9
ssht968 2003-10-04
  • 打赏
  • 举报
回复
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 3585
ClientLeft = 45
ClientTop = 735
ClientWidth = 3510
DrawMode = 8 'Xor Pen
FillStyle = 0 'Solid
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
NegotiateMenus = 0 'False
ScaleHeight = 3585
ScaleWidth = 3510
ShowInTaskbar = 0 'False
Begin VB.TextBox Text1
Alignment = 1 'Right Justify
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000001&
Height = 495
Left = 0
TabIndex = 21
Top = 0
Width = 3495
End
Begin VB.CommandButton cmd_CE
Height = 375
Left = 120
Picture = "Form1.frx":0000
Style = 1 'Graphical
TabIndex = 19
Top = 3000
Width = 735
End
Begin VB.CommandButton cmd_Back
Height = 375
Left = 480
Picture = "Form1.frx":047D
Style = 1 'Graphical
TabIndex = 18
Top = 600
Width = 975
End
Begin VB.CommandButton cmd_Sqrt
Height = 375
Left = 1680
Picture = "Form1.frx":09FE
Style = 1 'Graphical
TabIndex = 17
Top = 600
Width = 495
End
Begin VB.CommandButton cmd_Mod
Height = 375
Left = 2400
Picture = "Form1.frx":0E51
Style = 1 'Graphical
TabIndex = 16
Top = 600
Width = 495
End
Begin VB.CommandButton cmd_Divided
Height = 375
Left = 3000
Picture = "Form1.frx":1238
Style = 1 'Graphical
TabIndex = 15
Top = 600
Width = 495
End
Begin VB.CommandButton Command1
Height = 375
Left = 3000
Picture = "Form1.frx":1604
Style = 1 'Graphical
TabIndex = 14
Top = 1200
Width = 495
End
Begin VB.CommandButton Command2
Height = 375
Left = 3000
Picture = "Form1.frx":19CD
Style = 1 'Graphical
TabIndex = 13
Top = 2400
Width = 495
End
Begin VB.CommandButton Command3
Height = 375
Left = 3000
Picture = "Form1.frx":1D87
Style = 1 'Graphical
TabIndex = 12
Top = 3000
Width = 495
End
Begin VB.CommandButton Command
Height = 375
Index = 0
Left = 2160
Picture = "Form1.frx":2149
Style = 1 'Graphical
TabIndex = 11
Top = 3000
Width = 495
End
Begin VB.CommandButton Command
Height = 375
Index = 1
Left = 240
Picture = "Form1.frx":2533
Style = 1 'Graphical
TabIndex = 10
Top = 2400
Width = 495
End
Begin VB.CommandButton Command
Height = 375
Index = 2
Left = 1200
Picture = "Form1.frx":28F9
Style = 1 'Graphical
TabIndex = 9
Top = 2400
Width = 495
End
Begin VB.CommandButton Command
Height = 375
Index = 3
Left = 2160
Picture = "Form1.frx":2CE0
Style = 1 'Graphical
TabIndex = 8
Top = 2400
Width = 495
End
Begin VB.CommandButton Command
Height = 375
Index = 4
Left = 240
Picture = "Form1.frx":30C4
Style = 1 'Graphical
TabIndex = 7
Top = 1800
Width = 495
End
Begin VB.CommandButton Command
Height = 375
Index = 5
Left = 1200
Picture = "Form1.frx":34A2
Style = 1 'Graphical
TabIndex = 6
Top = 1800
Width = 495
End
Begin VB.CommandButton Command
Height = 375
Index = 6
Left = 2160
Picture = "Form1.frx":3883
Style = 1 'Graphical
TabIndex = 5
Top = 1800
Width = 495
End
Begin VB.CommandButton Command
Height = 375
Index = 7
Left = 240
Picture = "Form1.frx":3C65
Style = 1 'Graphical
TabIndex = 4
Top = 1200
Width = 495
End
Begin VB.CommandButton Command
Height = 375
Index = 8
Left = 1200
Picture = "Form1.frx":403B
Style = 1 'Graphical
TabIndex = 3
Top = 1200
Width = 495
End
Begin VB.CommandButton Command
Height = 375
Index = 9
Left = 2160
Picture = "Form1.frx":4425
Style = 1 'Graphical
TabIndex = 2
Top = 1200
Width = 495
End
Begin VB.CommandButton Command
Height = 375
Index = 10
Left = 1200
Picture = "Form1.frx":4809
Style = 1 'Graphical
TabIndex = 1
Top = 3000
Width = 495
End
Begin VB.CommandButton Command4
Height = 375
Left = 3000
Picture = "Form1.frx":4BAC
Style = 1 'Graphical
TabIndex = 0
Top = 1800
Width = 495
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Height = 375
Left = 0
TabIndex = 20
Top = 480
Width = 375
End
ssht968 2003-10-04
  • 打赏
  • 举报
回复






Private Sub cmd_CE_Click()
obtain = Null
If obtain = Null Then
Label2.Caption = obtain
End If


End Sub

Private Sub Command_Click(Index As Integer)
Static get_Value As String 'get the Command'value as 0 ....9
Static set_Value As String 'It isn't uesed
Dim point_Sum As Integer
point_Sum = 0
Select Case Command(Index)
Case Command(1)
Shape(1).FillColor = RGB(10, 222, 10)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "1"
set_Value = Text1.Text & get_Value

Case Command(2)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(10, 222, 10)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = 2
set_Value = Text1.Text & get_Value
Case Command(3)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(10, 222, 10)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "3"
set_Value = Text1.Text & get_Value
Case Command(4)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(10, 222, 10)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "4"
set_Value = Text1.Text & get_Value
Case Command(5)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(10, 222, 10)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "5"
set_Value = Text1.Text & get_Value
Case Command(6)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(10, 222, 10)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "6"
set_Value = Text1.Text & get_Value
Case Command(7)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(10, 222, 10)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "7"
set_Value = Text1.Text & get_Value
Case Command(8)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(10, 222, 10)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "8"
set_Value = Text1.Text & get_Value
Case Command(9)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(10, 222, 10)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "9"
set_Value = Text1.Text & get_Value
Case Command(0)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(10, 222, 10)
get_Value = "0"
set_Value = Text1.Text & get_Value
Case Command(10)


If Text1.Text = "" Then
get_Value = "0."
End If
If point_Sum <= 1 Then
point_Sum = poing + 1
get_Value = "."
ElseIf point_Sum > 1 Then
get_Value = ""
End If
End Select
Text1.Text = set_Value & get_Value
set_Value = Text1.Text
End Sub






Private Sub Label2_Change()
If Label2.Caption = "00" Then
Label2.Caption = 0
End If
End Sub


goodname008 2003-10-03
  • 打赏
  • 举报
回复
能不能用记事本打开.frm窗体文件,然后把记事本中的代码贴过来?
ssht968 2003-10-03
  • 打赏
  • 举报
回复
依照我的程序,具体应该怎么应用??
我看了你的贴,但问题,是必须有STRING1 如果我想得到是否有的话,我无法指定strign1
string2
goodname008 2003-10-02
  • 打赏
  • 举报
回复
根据字符串调用过程用CallByName函数


CallByName 函数



执行一个对象的方法,或者设置或返回一个对象的属性。

语法

CallByName(object, procedurename, calltype,[arguments()])

CallByName 函数的语法有以下部分:

部分 描述
object 必需的;变体型(对象)。函数将要执行的对象的名称。
procedurename 必需的;变体型(字符串)。一个包含该对象的属性名称或者方法名称的字符串表达式。
calltype 必需的;常数。一个 vbCallType 类型的常数,代表正在被调用的过程的类型。
arguments() 可选的:变体型(数组)。


说明

CallByName 函数用于获取或者设置一个属性,或者在运行时使用一个字符串名称来调用一个方法。

在下面的例子中,第一行使用 CallByName 来设置一个文本框的 MousePointer 属性,第二行得到 MousePointer 属性的值,第三行调用 Move 方法来移动文本框:

CallByName Text1, "MousePointer", vbLet, vbCrosshair
Result = CallByName (Text1, "MousePointer", vbGet)
CallByName Text1, "Move", vbMethod, 100, 100
goodname008 2003-10-02
  • 打赏
  • 举报
回复
判断某个字符串中是否含有某个字符用InStr函数.


InStr 函数


返回 Variant (Long),指定一字符串在另一字符串中最先出现的位置。

语法

InStr([start, ]string1, string2[, compare])

InStr 函数的语法具有下面的参数:

部分 说明
start 可选参数。为数值表达式,设置每次搜索的起点。如果省略,将从第一个字符的位置开始。如果 start 包含 Null,将发生错误。如果指定了 compare 参数,则一定要有 start 参数。
string1 必要参数。接受搜索的字符串表达式。
string2 必要参数。被搜索的字符串表达式。
Compare 可选参数。指定字符串比较。如果 compare 是 Null,将发生错误。如果省略 compare,Option Compare 的设置将决定比较的类型。


设置

compare 参数设置为:

常数 值 描述
vbUseCompareOption -1 使用Option Compare 语句设置执行一个比较。
vbBinaryCompare 0 执行一个二进制比较。
vbTextCompare 1 执行一个按照原文的比较。
vbDatabaseCompare 2 仅适用于Microsoft Access,执行一个基于数据库中信息的比较。


返回值

如果 InStr返回
string1 为零长度 0
string1 为 Null Null
string2 为零长度 Start
string2 为 Null Null
string2 找不到 0
在 string1 中找到string2 找到的位置
start > string2 0


说明

InStrB 函数作用于包含在字符串中的字节数据。所以 InStrB 返回的是字节位置,而不是字符位置。
ssht968 2003-10-02
  • 打赏
  • 举报
回复
我创建了comamnd()组,工0--9个,每个都有相应的时间如何

在我在窗体上输入1,2,3,--9时调用到它们??

而且我还想 判断我的label 里是否有"."?
我写个计算器中我在输入"."的过程中。会输入两个"."

Private Sub Command_Click(Index As Integer)
Static get_Value As String 'get the Command'value as 0 ....9
Static set_Value As String 'It isn't uesed
Dim point_Sum As Integer
point_Sum = 0
Select Case Command(Index)
Case Command(1)
Shape(1).FillColor = RGB(10, 222, 10)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "1"
set_Value = Text1.Text & get_Value

Case Command(2)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(10, 222, 10)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = 2
set_Value = Text1.Text & get_Value
Case Command(3)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(10, 222, 10)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "3"
set_Value = Text1.Text & get_Value
Case Command(4)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(10, 222, 10)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "4"
set_Value = Text1.Text & get_Value
Case Command(5)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(10, 222, 10)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "5"
set_Value = Text1.Text & get_Value
Case Command(6)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(10, 222, 10)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "6"
set_Value = Text1.Text & get_Value
Case Command(7)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(10, 222, 10)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "7"
set_Value = Text1.Text & get_Value
Case Command(8)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(10, 222, 10)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "8"
set_Value = Text1.Text & get_Value
Case Command(9)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(10, 222, 10)
Shape(0).FillColor = RGB(255, 255, 255)
get_Value = "9"
set_Value = Text1.Text & get_Value
Case Command(0)
Shape(1).FillColor = RGB(255, 255, 255)
Shape(2).FillColor = RGB(255, 255, 255)
Shape(3).FillColor = RGB(255, 255, 255)
Shape(4).FillColor = RGB(255, 255, 255)
Shape(5).FillColor = RGB(255, 255, 255)
Shape(6).FillColor = RGB(255, 255, 255)
Shape(7).FillColor = RGB(255, 255, 255)
Shape(8).FillColor = RGB(255, 255, 255)
Shape(9).FillColor = RGB(255, 255, 255)
Shape(0).FillColor = RGB(10, 222, 10)
get_Value = "0"
set_Value = Text1.Text & get_Value
Case Command(10)


If Text1.Text = "" Then
get_Value = "0."
End If
If point_Sum <= 1 Then
point_Sum = poing + 1
get_Value = "."
ElseIf point_Sum > 1 Then
get_Value = ""
End If
End Select
Text1.Text = set_Value & get_Value
set_Value = Text1.Text
End Sub
这里的小数点没办法判断呀。?
aha99 2003-10-02
  • 打赏
  • 举报
回复
楼上的没错,具体实现就是算法的事情了
goodname008 2003-10-02
  • 打赏
  • 举报
回复
Option Explicit

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 111, 191
Label1.Caption = "/"
Case 106, 56
Label1.Caption = "*"
Case 109, 189
Label1.Caption = "-"
Case 107, 187
Label1.Caption = "+"
End Select
End Sub

Private Sub Form_Load()
Me.KeyPreview = True
End Sub

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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