我的VB教程(会陆续更新)
解压后,双击“课件.exe”运行,以后还会陆续加上,毕竟本人是菜鸟,只是想帮助比我更菜的菜鸟。喜欢就顶上!本程序不是视频教程!
截图:
本程序课件.exe源码,欢迎借鉴利用:
程序代码:
Dim y As Integer '页码 Dim nei As Variant, a As Variant 'VB控件随窗体大小而变化 ' Option Explicit Private FormOldWidth As Long '保存窗体的原始宽度 Private FormOldHeight As Long '保存窗体的原始高度 '在调用ResizeForm前先调用本函数 Public Sub ResizeInit(FormName As Form) Dim Obj As Control FormOldWidth = FormName.ScaleWidth FormOldHeight = FormName.ScaleHeight On Error Resume Next For Each Obj In FormName Obj.Tag = Obj.Left & " " & Obj.Top & " " & Obj.Width & " " & Obj.Height & " " Next Obj On Error GoTo 0 End Sub '按比例改变表单内各元件的大小, '在调用ReSizeForm前先调用ReSizeInit函数 Public Sub ResizeForm(FormName As Form) Dim Pos(4) As Double Dim i As Long, TempPos As Long, StartPos As Long Dim Obj As Control Dim ScaleX As Double, ScaleY As Double ScaleX = FormName.ScaleWidth / FormOldWidth '保存窗体宽度缩放比例 ScaleY = FormName.ScaleHeight / FormOldHeight '保存窗体高度缩放比例 On Error Resume Next For Each Obj In FormName StartPos = 1 For i = 0 To 4 '读取控件的原始位置与大小 TempPos = InStr(StartPos, Obj.Tag, " ", vbTextCompare) If TempPos > 0 Then Pos(i) = Mid(Obj.Tag, StartPos, TempPos - StartPos) StartPos = TempPos + 1 Else Pos(i) = 0 End If '根据控件的原始位置及窗体改变大小 '的比例对控件重新定位与改变大小 Obj.Move Pos(0) * ScaleX, Pos(1) * ScaleY, Pos(2) * ScaleX, Pos(3) * ScaleY Next i Next Obj On Error GoTo 0 End Sub Private Sub Command1_Click() y = y - 1 If y = 0 Then y = 1 If y = -1 Then y = 1 a = Format(y) + ".bmp" '命名 Image1.Picture = LoadPicture(a) Open "1.txt" For Input As #10 '(打开文件,方式是读取) For i = 1 To y 'Line Input #10, s '(读取第一行) Line Input #10, nei If EOF(10) = True Then y = 1 Exit For End If Next i Text1 = nei Close #10 '('关闭文件) If (Text1 = "学习完成") = False Then Command2.Enabled = True '按钮可用性 End Sub Private Sub Command2_Click() y = y + 1 a = Format(y) + ".bmp" '命名 Image1.Picture = LoadPicture(a) Open "1.txt" For Input As #10 '(打开文件,方式是读取) For i = 1 To y 'Line Input #10, s '(读取第一行) Line Input #10, nei If EOF(10) = True Then y = 1 Exit For End If Next i Text1 = nei Close #10 '('关闭文件) If Text1 = "end" Then Command2.Enabled = False '取消按钮可用性 Text1 = "学习完成" End If End Sub Private Sub Command3_Click() y = Val(Text2) Open "1.txt" For Input As #10 '(打开文件,方式是读取) For i = 1 To y 'Line Input #10, s '(读取第一行) Line Input #10, nei If EOF(10) = True Then y = 0 mkmkmk = MsgBox("超出课件长度", 16, "输入有误") Exit For End If Next i Text1 = nei Close #10 '('关闭文件) If Text1 = "end" Then Command2.Enabled = False '取消按钮可用性 Text1 = "学习完成" End If If y = 0 Then mkmkmk = MsgBox("非法数字", 16, "输入有误") End If If mkmkmk = 1 Then Print "" Else a = Format(y) + ".bmp" '命名 Image1.Picture = LoadPicture(a) End If End Sub Private Sub Form_Load() Call ResizeInit(Me) '在程序装入时必须加入 End Sub Private Sub Form_Resize() Call ResizeForm(Me) '确保窗体改变时控件随之改变 End Sub好了,言归正题,发课件
杨文博VB教程
第一章,VB的认识
杨文博VB教程第一章VB的认识第一节.rar
(239.13 KB)
杨文博VB教程第一章VB的认识第二节.rar
(1.17 MB)
第二章,Hello World(简单程序编辑)视频教程 陆续上传中。。。。。。
杨文博VB教程第二章 HelloWrold.part01.rar
(1.86 MB)
杨文博VB教程第二章 HelloWrold.part02.rar
(1.86 MB)
杨文博VB教程第二章 HelloWrold.part03.rar
(1.86 MB)
杨文博VB教程第二章 HelloWrold.part04.rar
(1.86 MB)
杨文博VB教程第二章 HelloWrold.part05.rar
(1.86 MB)
杨文博VB教程第二章 HelloWrold.part06.rar
(1.86 MB)
杨文博VB教程第二章 HelloWrold.part07.rar
(1.86 MB)
剩下的在第15楼[ 本帖最后由 yangwenbo99 于 2012-7-7 21:18 编辑 ]