vb 部分课件整理文档格式.docx
- 文档编号:20844268
- 上传时间:2023-01-26
- 格式:DOCX
- 页数:26
- 大小:119.83KB
vb 部分课件整理文档格式.docx
《vb 部分课件整理文档格式.docx》由会员分享,可在线阅读,更多相关《vb 部分课件整理文档格式.docx(26页珍藏版)》请在冰豆网上搜索。
EndSub
nameAsString*8salaryAsLong
EndType'
recno表示记录号
PublicsalAssalary,recnoAsInteger'
检查编号的通用过程
Functioncheno(noAsString)AsBoolean
recno=Val(no)
Ifrecno<
0Orrecno>
999Then
MsgBox"
输入的职工号超出范围"
0,"
检查编号"
cheno=True
Else
cheno=False
EndIf
EndFunction
Get#1,1,sal
Text1.Text=Format(1,"
000"
Text2.Text=sal.name
Text3.Text=sal.salary
'
"
查询"
按钮的click事件过程
PrivateSubCommand1_Click()
Ifcheno(Text1.Text)ThenExitSub
Ifrecno>
LOF
(1)/Len(sal)Then
无此记录"
ExitSub
Get#1,recno,sal
Text3.Text=Str(sal.salary)
Text1.SetFocus'
设置焦点
增加"
PrivateSubCommand2_Click()
sal.name=Text2.Text
sal.salary=Val(Text3.Text)
Put#1,recno,sal
Text1.SetFocus
清除"
PrivateSubCommand3_Click()
sal.name="
记录内容清空
sal.salary=0
Text2.Text="
文本框清空
Text3.Text="
EndSub'
关闭"
PrivateSubCommand4_Click()
UnloadMe
PrivateTypenumval
squreAsInteger
cubeAsLong
sqrootAsSingle
DimnvAsnumval'
定义一个numval类型的变量nu
data1.dat"
ForRandomAs#1Len=Len(nv)
Fori=1To10'
写入记录程序段
nv.squre=i*i
nv.cube=i*i*i
nv.sqroot=Sqr(i)
Put#1,i,nv
Show'
读出记录程序段
Fori=2To10Step4'
读出3个记录
Get#1,i,nv
Print"
第"
;
i;
"
号记录:
nv.squre,nv.cube,nv.sqroot
Show
mytxt.txt"
ForOutputAs#1
a=1234:
b$="
ABCD"
Print#1,a,b$'
写入第1个记录
Print#1,a;
b$'
写入第2个记录
ForInputAs#1
LineInput#1,x$'
读出第1个记录
Printx$
读出第2个记录
c:
\mydocuments\cj2.txt"
Open"
d:
\temp\cj2.txt"
DimnAsString,mAsString,sAsInteger
DimxAsString,tAsInteger,cAsInteger
t=0:
c=5
Fori=1Toc
Input#1,n,m,s
x=n+String(2,32)+m+Str(s)
List1.AddItemx
t=t+s
Text1.Text=t/5
k=0
num2.txt"
DoWhileNotEOF
(1)'
文件未结束时,循环
Input#1,x
Printx,
k=k+1
IfkMod4=0ThenPrint'
每显示4个数后换行
Loop
data1.txt"
Write#1,a,b$'
存入
Input#1,c,d$'
读出
Printc,d$
DimnumAsString*6,nameAsString*8,scoreAsInteger
num=Text1.Text
name=Text2.Text
score=Val(Text3.Text)
Write#1,num,name,score'
Text1.Text="
存完1个记录后清空
ForAppendAs#1
Fori=51To200
IfiMod7=0ThenWrite#1,i
num1.txt"
ForOutputAs#2
Fori=1To50
Write#1,i
IfiMod7=0ThenWrite#2,i
Close#1,#2
DimaxAsSingle,ayAsSingle
DimpxAsSingle,pyAsSingle
DimtempAsInteger
Picture2.BackColor=RGB(VScroll1(0).Value,VScroll1
(1).Value,VScroll1
(2).Value)
ax=0
ay=0
px=0
py=0
PrivateSubOption1_Click()
temp=1
Label2.Caption="
按下鼠标左键并拖动到终点绘直线"
PrivateSubOption2_Click()
temp=2
按下鼠标左键并拖动绘矩形"
PrivateSubOption3_Click()
temp=3
按下鼠标左键并拖动绘圆"
PrivateSubOption4_Click()
temp=4
按下鼠标左键并拖动绘曲线"
PrivateSubPicture1_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
IfButton=1Then
ax=X
ay=Y
EndIf
Iftemp=4Then
Picture1.CurrentX=X
Picture1.CurrentY=Y
PrivateSubPicture1_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
Iftemp=1Then
Picture1.Line(ax,ay)-(px,py),Picture1.BackColor
Iftemp=2Then
Picture1.Line(ax,ay)-(ax,py),Picture1.BackColor
Picture1.Line(ax,ay)-(px,ay),Picture1.BackColor
Picture1.Line(px,ay)-(px,py),Picture1.BackColor
Picture1.Line(ax,py)-(px,ay),Picture1.BackColor
Iftemp=3Then
Picture1.Circle((ax+px)/2,(ax+py)/2),0.5*Sqr((px-ax)^2+(py-ay)^2),Picture1.BackColor
Iftemp=1Then
Picture1.Line(ax,ay)-(X,Y)
px=X
py=Y
Iftemp=2Then
Picture1.Line(ax,ay)-(X,ay)
Picture1.Line(ax,ay)-(ax,Y)
Picture1.Line(ax,Y)-(X,Y)
Picture1.Line(X,ay)-(X,Y)
Iftemp=3Then
Picture1.Circle((ax+X)/2,(ay+Y)/2),0.5*Sqr((X-ax)^2+(Y-ay)^2)
Iftemp=4Then
Picture1.Line-(X,Y)
PrivateSubPicture1_MouseUp(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)
PrivateSubPicture1_Resize()
Picture1.Refresh
PrivateSubVScroll1_Change(IndexAsInteger)
Picture1.ForeColor=RGB(VScroll1(0).Value,VScroll1
(1).Value,VScroll1
(2).Value)
DimxAsSingle,yAsSingle
ConstpiAsDouble=3.1415926
Timer1.Enabled=True
Form1.Scale(-10,10)-(10,-10)
Me.Line(-10,0)-(10,0)
Me.Line(0,10)-(0,-10)
CurrentX=-2*pi:
CurrentY=0:
Print"
-2π"
CurrentX=-pi:
-π"
CurrentX=0.1:
CurrentY=0”Print"
0"
:
CurrentX=pi:
π"
CurrentX=2*pi:
2π"
x=-10:
y=-10:
PrivateSubTimer1_Timer()
x=x+0.01
y=y+0.01
PSet(x,y)
CurrentX=-2*pi
CurrentY=0
CurrentX=-pi
CurrentX=0.1
CurrentX=pi
CurrentX=2*pi
x=-10
y=-10
OptionExplicit
PrivateSubOption1_Click(IndexAsInteger)
SelectCaseIndex
Case0
Shape1.BorderColor=vbRed
Case1
Shape1.BorderColor=vbGreen
Case2
Shape1.BorderColor=vbBlue
EndSelect
PrivateSubOption2_Click(IndexAsInteger)
Shape1.FillColor=vbRed
Shape1.FillColor=vbGreen
Shape1.FillColor=vbBlue
PrivateSubOption3_Click(IndexAsInteger)
Shape1.Shape=vbShapeCircle
Shape1.Shape=vbShapeOval
Shape1.Shape=vbShapeRectangle
Dimarlph
Constpi=3.14159265
Line1.X2=0
Line1.Y2=1.2
arlph=pi/2
Timer1.Enabled=False
Picture1.Scale(-2,2)-(2,-2)
Line1.X1=0
Line1.Y1=0
arlph=arlph-360/60*pi/180
Line1.X2=1.2*Cos(arlph)
Line1.Y2=1.2*Sin(arlph)
PrivateSubForm_Click()
Dimt
Dimx
Dimy
Form1.Scale(-1,1)-(1,-1)
DrawWidth=2
Fort=0To2*3.1415926Step0.001
x=Sin(2*t)*Cos(t)
y=Sin(2*t)*Sin(t)
PSet(x,y),QBColor
(2)
CallWait
Nextt
PrivateSubWait()
DimxAsInteger
x=10000
Whilex
x=x-1
Wend
'
CommonDialog1.Action=1
CommonDialog1.ShowOpen
Image1.Picture=LoadPicture(CommonDialog1.FileName)
CommonDialog1.ShowColor
Text1.ForeColor=CommonDialog1.Color
Text1.BackColor=CommonDialog1.Color
CommonDialog1.Flags=cdlCFBothOrcdlCFEffects
CommonDialog1.ShowFont
Text1.FontName=CommonDialog1.FontName
Text1.FontSize=CommonDialog1.FontSize
Text1.FontBold=CommonDialog1.FontBold
Text1.FontItalic=CommonDialog1.FontItalic
Text1.FontStrikethru=
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- vb 部分课件整理 部分 课件 整理