ImageVerifierCode 换一换
格式:DOCX , 页数:25 ,大小:131.98KB ,
资源ID:124778      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-124778.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(VB编程案例蝴蝶飞舞计算器加密解密矩阵转置鸟巢统计文本编辑小球跳动学生信息录入窗口.docx)为本站会员(b****1)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

VB编程案例蝴蝶飞舞计算器加密解密矩阵转置鸟巢统计文本编辑小球跳动学生信息录入窗口.docx

1、VB编程案例蝴蝶飞舞计算器加密解密矩阵转置鸟巢统计文本编辑小球跳动学生信息录入窗口目录一、鸟巢绘制2二、加密3三、解密4四、蝴蝶飞舞6五、文本编辑6六、统计9七、小球跳动11八、计算器(彩票摇奖)12九、学生信息录入16十、矩阵转置17一、鸟巢绘制Private Sub Form_Click()ClsDim r, xi, yi, xj, yj, x0, y0, aif As Singler = Form10.ScaleHeight / 2x0 = Form10.ScaleWidth / 2y0 = Form10.ScaleHeight / 2n = 16aif = 3.14159 * 2 /

2、nFor i = 1 To nxi = r * Cos(i * aif) + x0yi = r * Sin(i * aif) + y0 For j = i To n xj = r * Cos(j * aif) + x0 yj = r * Sin(j * aif) + y0 Line (xi, yi)-(xj, yj), QBColor(i - 1) PSet (xi, yi) Print i - 1 Next jNext i End SubPrivate Sub Form_Load()Print 要求: ;Print 1.将圆周等分成16份;Print 2.每个等分点要标记成0-16的数字;P

3、rint 3.按样本图的图案画图。End Sub附图:二、加密Function code(ByVal s$, ByVal key%)Dim c As String * 1, iAsc%code = For i = 1 To Len(s)c = Mid$(s, i, 1)Select Case cCase A To ZiAsc = Asc(c) + keyIf iAsc Asc(Z) Then iAsc = iAsc - 26code = code + Chr(iAsc)Case a To ziAsc = Asc(c) + keyIf iAsc Asc(z) Then iAsc = iAsc -

4、 26code = code + Chr(iAsc)Case Elsecode = code + cEnd SelectNext iEnd FunctionPrivate Sub close_Click()Form11.HideForm1.ShowEnd SubPrivate Sub Jiami_Click()Text2 = code(Text1, 2)End SubPrivate Sub open_Click()CommonDialog1.Action = 1Text1.Text = Open CommonDialog1.FileName For Input As #1Dim counter

5、 As IntegerDim workarea(25000) As StringProgressBar1.min = LBound(workarea)ProgressBar1.max = UBound(workarea)ProgressBar1.Visible = TrueProgressBar1.Value = ProgressBar1.minFor counter = LBound(workarea) To UBound(workarea)workarea(counter) = initial value & counterProgressBar1.Value = counterNext

6、counterDo While Not EOF(1)Line Input #1, inputdataText1.Text = Text1.Text + inputdata + vbCrLfLoopClose #1End SubPrivate Sub save_Click()CommonDialog1.FileName = a1.txtCommonDialog1.DefaultExt = txtCommonDialog1.Action = 2Open CommonDialog1.FileName For Output As #1Print #1, Text2.TextClose #1End Su

7、b三、解密Function UnCode(ByVal s$, ByVal key%) Dim c As String * 1, iAsc% UnCode = For i = 1 To Len(s) c = Mid$(s, i, 1) Select Case c Case A To Z iAsc = Asc(c) - key If iAsc Asc(A) Then iAsc = iAsc + 26 UnCode = UnCode + Chr(iAsc) Case a To z iAsc = Asc(c) - key If iAsc Asc(a) Then iAsc = iAsc + 26 UnC

8、ode = UnCode + Chr(iAsc) Case Else UnCode = UnCode + c End Select Next iEnd FunctionPrivate Sub close_Click()Form2.HideForm1.ShowEnd SubPrivate Sub Jiemi_Click()Text2 = UnCode(Text1, 2)End SubPrivate Sub open_Click()CommonDialog1.Action = 1Text1.Text = Open CommonDialog1.FileName For Input As #1Dim

9、counter As IntegerDim workarea(25000) As StringProgressBar1.min = LBound(workarea)ProgressBar1.max = UBound(workarea)ProgressBar1.Visible = TrueProgressBar1.Value = ProgressBar1.minFor counter = LBound(workarea) To UBound(workarea)workarea(counter) = initial value & counterProgressBar1.Value = count

10、erNext counterDo While Not EOF(1)Line Input #1, inputdataText1.Text = Text1.Text + inputdata + vbCrLfLoopClose #1End SubPrivate Sub save_Click()CommonDialog1.FileName = a.txtCommonDialog1.DefaultExt = txtCommonDialog1.Action = 2Open CommonDialog1.FileName For Output As #1Print #1, Text2.TextClose #1

11、End Sub四、蝴蝶飞舞Private Sub Form_Load()Print 蝴蝶飞出窗体后重新定位到左下方再向右上方飞End SubPrivate Sub Timer1_Timer()Static PickBmp As IntegerIf PickBmp = 0 Then Image1.Picture = Image2.Picture PickBmp = 1Else Image1.Picture = Image3.Picture PickBmp = 0End IfCall mymoveEnd SubSub mymove()Image1.Move Image1.Left + 40, Im

12、age1.Top - 25If Image1.Top = 0 Then Image1.Left = 0 Image1.Top = 2325End IfEnd Sub图:五、文本编辑Private Sub Copy_Click()Clipboard.ClearClipboard.SetText RichTextBox1.SelTextEnd SubPrivate Sub Cut_Click()Clipboard.ClearClipboard.SetText RichTextBox1.SelTextRichTextBox1.SelText = End SubPrivate Sub Exit_Cli

13、ck()Form3.HideForm1.ShowEnd SubPrivate Sub Font_Click()CommonDialog1.Flags = cdlCFBoth Or cdlCFEffectsCommonDialog1.Action = 4RichTextBox1.FontName = CommonDialog1.FontNameRichTextBox1.FontSize = CommonDialog1.FontSizeRichTextBox1.FontBold = CommonDialog1.FontBoldRichTextBox1.FontItalic = CommonDial

14、og1.FontItalicRichTextBox1.FontStrikethru = CommonDialog1.FontStrikethruRichTextBox1.FontUnderline = CommonDialog1.FontUnderlineRichTextBox1.ForeColor = CommonDialog1.ColorEnd SubPrivate Sub Form_Load()Print 注:Print 1.打开对话框的初始文件夹应是所要打开文件所在的Print 文件夹,将提供的xz.txt文件打开;Print 2.要实现将选定的内容格式化,必须在工具箱中添加Print

15、 RichTextBox控件(Microsoft Rich Textbox Comtrol 6.0)Print 并在帮助菜单中查阅其字体设置的相关属性。Print 3.TichTextBox中要设置垂直滚动条,文本格式化时要将选Print 定的内容格式化。End SubPrivate Sub Label1_Click()End SubPrivate Sub open_Click()CommonDialog1.Action = 1RichTextBox1.Text = Open CommonDialog1.FileName For Input As #1Do While Not EOF(1)Li

16、ne Input #1, inputdataRichTextBox1.Text = RichTextBox1.Text + inputdata + vbCrLfLoopClose #1End SubPrivate Sub Paste_Click()RichTextBox1.SelText = Clipboard.GetTextEnd SubPrivate Sub Print_Click()CommonDialog1.Action = 5For i = 1 To CommonDialog1.CopiesPrinter.Print RichTextBox1.TextNext iPrinter.En

17、dDocEnd SubSub RichTextBox1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)If Button = 2 Then PopupMenu EditMenu, vbPopupMenuCenterAlignEnd SubPrivate Sub save_Click() CommonDialog1.Action = 2Print #1,Close #1End SubPrivate Sub SaveAs_Click()CommonDialog1.FileName = default.

18、TxtCommonDialog1.DefaultExt = TxtCommonDialog1.Action = 2Open CommonDialog1.FileName For Output As #1Print #1, RichTextBox1.TextClose #1图:六、统计Dim a(0 To 9), i%, min%, max%, ave%Private Sub Command1_Click()Dim j%, imin%, s%, t%Form5.ClsCurrentX = 0CurrentY = 0For i = 0 To 9a(i) = Int(Rnd * 90 + 10)s

19、= s + a(i)Print a(i);Next iave = s / 10For i = 0 To 8imin = i For j = i + 1 To 9 If a(j) a(imin) Then imin = j Next jt = a(i)a(i) = a(imin)a(imin) = tNext iEnd SubPrivate Sub Command2_Click()Print For i = 0 To 9Print a(i);Next iEnd SubPrivate Sub Command3_Click()Print Print a(9);End SubPrivate Sub C

20、ommand4_Click()Print Print a(0);End SubPrivate Sub Command5_Click()Print Print ave;End SubPrivate Sub Command6_Click()Form1.ShowForm5.HideEnd SubPrivate Sub Form_Load()Print 将随机产生的10个2位数升序排序,并求出其最大值、最小Print 值和平均值。End Sub图:七、小球跳动Dim d As BooleanPrivate Sub Form_Load()Shape1.Shape = 3Shape1.FillColor

21、= vbRedShape1.FillStyle = 0Timer1.Interval = 20End SubPrivate Sub Timer1_Timer()If Not d ThenIf Shape1.Top 100 ThenShape1.Top = Shape1.Top - 100Elsed = Not dEnd IfEnd IfEnd Sub图:八、计算器(彩票摇奖)Private Sub Command1_Click()Dim x, i%, a%(0 To 4), j%RandomizeFor i = 0 To 4 Do a(i) = Int(Rnd * 30) For j = 0

22、To i - 1 If a(i) = a(j) Then Exit For Next j Loop While j ix = a(i) & & xText1 = xNext iEnd SubPrivate Sub Command2_Click()Dim b%(0 To 4), k%, l%, q%, r%, y As String, cy = Trim$(Text1)c = Split(y, )Randomizen = 0For k = 0 To 4Do b(k) = Int(Rnd * 30) For l = 0 To k - 1 If b(k) = b(l) Then Exit For N

23、ext l Loop While l kNext kFor q = 0 To 4 For r = 0 To 4 If b(q) = c(r) Then n = n + 1 End IfNext rNext qIf n = 0 ThenClsPrint 编写一个简易的30选5彩票摇奖程序。功能要求用户可以输入5个不同的整数,或Print 者通过机选按钮,自动生成5个互不相同的随机数;单击摇奖按钮,生成中奖号码,Print 并对用户输入或机选的彩票数字进行评奖,用户选对1个数字,获5等奖,选对2个数Print 获4等奖.程序运行界面如样本所示。CurrentY = 1900CurrentX = 3

24、00Print 本期中奖号码为: & b(0); b(1); b(2); b(3); b(4)Print CurrentX = 300Print 对不起,您没有中奖ElseIf n = 1 ThenClsPrint 编写一个简易的30选5彩票摇奖程序。功能要求用户可以输入5个不同的整数,或Print 者通过机选按钮,自动生成5个互不相同的随机数;单击摇奖按钮,生成中奖号码,Print 并对用户输入或机选的彩票数字进行评奖,用户选对1个数字,获5等奖,选对2个数Print 获4等奖.程序运行界面如样本所示。CurrentY = 1900CurrentX = 300Print 本期中奖号码为: &

25、 b(0); b(1); b(2); b(3); b(4)Print CurrentX = 300Print 恭喜了,您中了五等奖ElseIf n = 2 ThenClsPrint 编写一个简易的30选5彩票摇奖程序。功能要求用户可以输入5个不同的整数,或Print 者通过机选按钮,自动生成5个互不相同的随机数;单击摇奖按钮,生成中奖号码,Print 并对用户输入或机选的彩票数字进行评奖,用户选对1个数字,获5等奖,选对2个数Print 获4等奖.程序运行界面如样本所示。CurrentY = 1900CurrentX = 300Print 本期中奖号码为: & b(0); b(1); b(2)

26、; b(3); b(4)Print CurrentX = 300Print 恭喜了,您中了四等奖ElseIf n = 3 ThenClsPrint 编写一个简易的30选5彩票摇奖程序。功能要求用户可以输入5个不同的整数,或Print 者通过机选按钮,自动生成5个互不相同的随机数;单击摇奖按钮,生成中奖号码,Print 并对用户输入或机选的彩票数字进行评奖,用户选对1个数字,获5等奖,选对2个数Print 获4等奖.程序运行界面如样本所示。CurrentY = 1900CurrentX = 300Print 本期中奖号码为: & b(0); b(1); b(2); b(3); b(4)Print

27、 CurrentX = 300Print 恭喜了,您中了三等奖ElseIf n = 4 ThenClsPrint 编写一个简易的30选5彩票摇奖程序。功能要求用户可以输入5个不同的整数,或Print 者通过机选按钮,自动生成5个互不相同的随机数;单击摇奖按钮,生成中奖号码,Print 并对用户输入或机选的彩票数字进行评奖,用户选对1个数字,获5等奖,选对2个数Print 获4等奖.程序运行界面如样本所示。CurrentY = 1900CurrentX = 300Print 本期中奖号码为: & b(0); b(1); b(2); b(3); b(4)Print CurrentX = 300Pr

28、int 恭喜了,您中了二等奖ElseIf n = 5 ThenClsPrint 编写一个简易的30选5彩票摇奖程序。功能要求用户可以输入5个不同的整数,或Print 者通过机选按钮,自动生成5个互不相同的随机数;单击摇奖按钮,生成中奖号码,Print 并对用户输入或机选的彩票数字进行评奖,用户选对1个数字,获5等奖,选对2个数Print 获4等奖.程序运行界面如样本所示。CurrentY = 1900CurrentX = 300Print 本期中奖号码为: & b(0); b(1); b(2); b(3); b(4)Print CurrentX = 300Print 恭喜了,您中了一等奖End IfEnd SubPrivate Sub Command3_Click()

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2