7,762
社区成员
发帖
与我相关
我的任务
分享
Private Sub MSFlexGrid1_LeaveCell()
Dim ts As Single
ts = Val(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, MSFlexGrid1.Col))
If MSFlexGrid1.Row = 2 Then
If ts <= 0 Or ts > 3600 Then
MsgBox "范围:0 - 3600 秒", vbExclamation, "注意"
End If
Else
If MSFlexGrid1.Row = 3 Then
If ts < 190 Or ts > 700 Then
MsgBox "范围:190 - 700nm", vbExclamation, "注意"
End If
End If
End If
End Sub
Private Sub Command1_Click()
Set objVoice = CreateObject("SAPI.SpVoice")
s = Text1.Text
If s = "" Then
Exit Sub
ElseIf s = " " Then
n = Replace(board, Chr(10), "。。")
objVoice.Speak n
Else
objVoice.Speak s
End If
End Sub
窗体上有一个文本框和一个命令按钮,单击命令按钮,系统读出文本框的内容。(XP可以读英文和拼音,vista win7可以中英文阅读)Private Sub MSFlexGrid1_Click()
With MSFlexGrid1
Text1.Visible = True
Text1.Move .ColPos(.Col), .RowPos(.Row), .ColWidth(.Col), .RowHeight(.Row)
Text1.BackColor = &HC0FFC0
Text1.Text = ""
If .TextMatrix(.Row, .Col) = "" Then
Text1.Text = ""
Else
Text1.Text = .TextMatrix(.Row, .Col)
End If
Text1.SelLength = Len(Text1.Text)
Text1.SetFocus
End With
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii <> 13 Then Exit Sub
If Text1.BackColor = &HC0FFC0 Then
Text1.Visible = False
MSFlexGrid1.SetFocus
'数据是否合法,这里判断
'……略
MSFlexGrid1.Text = Text1.Text
End If
End Sub