- 1、本文档共5页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
VB小程序源代码
复制粘贴
Private Sub Command1_Click()
Clipboard.SetText Text1.SelText
End Sub
Private Sub Command2_Click()
Text2.SelText = Clipboard.GetText
End Sub
上海问题
Private Sub Command1_Click()
If Option3.Value = True Then
Text1 = You are right
Else
Text1 = You are wrong
End If
End Sub
中心问题
Private Sub Form_Resize()
Command1.Left = (Form1.ScaleWidth - Command1.Width) / 2
Command1.Top = (Form1.ScaleHeight - Command1.Height) / 2
Command1.Width = 0.2 * Form1.ScaleWidth
End Sub
曲线问题
Private Sub Form_Paint()
Scale (0, 0)-(3000, 3000)
Form1.DrawWidth = 5
Form1.ForeColor = RGB(255, 0, 0)
Line (0, 1500)-(3000, 1500)
Line (1500, 0)-(1500, 3000)
Circle (1500, 1500), 35
For x = 0 To 3000
y = 1500 - 200 * (Sin((x - 1500) * 3.1415926 / 180))
PSet (x, y)
Next x
End Sub
查找
Private Sub Command1_Click()
a = InStr(1, Text1, Text2)
Text1.SelStart = a - 1
Text1.SelLength = Len(Text2)
Text1.SetFocus
End Sub
Private Sub Text1_Change()
End Sub
改变字体
Private Sub Check1_Click()
If Check1.Value = 1 Then
Text1.Font.Name = 隶书
Else
Text1.Font.Name = 宋体
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
Text1.Font.Bold = True
Else
Text1.Font.Bold = False
End If
End Sub
Private Sub Check3_Click()
If Check3.Value = 1 Then
Text1.Font.Italic = True
Else
Text1.Font.Italic = False
End If
End Sub
Private Sub Check4_Click()
If Check4.Value = 1 Then
Text1.ForeColor = vbRed
Else
Text1.ForeColor = vbBlue
End If
End Sub
同步
Private Sub Text1_Change()
Text2 = Text1.Text
End Sub
Private Sub Text2_Change()
Text1 = Text2.Text
End Sub
Sin函数
Private Sub Form_Paint()
Scale (0, 0)-(2000, 2000)
PSet (1000, 1000)
Line (1000, 0)-(950, 50)
Line (1050, 50)-(1000, 0)
Line (1950, 950)-(2000, 1000)
Line (1950, 1050)-(2000, 1000)
Line (0, 1000)-(2000, 1000)
Line (1000, 0)-(1000, 2000)
Circle (1000, 1000), 50
For x = 0 To 2000
y = 1000 - 300 * (Sin((x - 1000) * 3.1415926 / 180))
PSet (x, y)
Next x
End Sub
考试程序
Private Sub Command1_Click()
If Option3.Value = True Then
Text1 = 正确
Else
Text1 = 错误
End If
End S
文档评论(0)