家电维修社团整理-1-更多精彩,静待家电维修P37#2-4PrivateSubcmdBegin_Click()Timer1.Enabled=True'激活定时器cmdBegin.Enabled=FalsecmdEnd.Enabled=TrueEndSubPrivateSubcmdEnd_Click()Timer1.Enabled=False'关闭定时器Label1.Left=0'标签归位到窗体左侧cmdBegin.Enabled=TruecmdEnd.Enabled=FalseEndSubPrivateSubForm_Load()Label1.Left=0'初始将标签归位到窗体左侧EndSubPrivateSubTimer1_Timer()Label1.MoveLabel1.Left+20'每隔0.1秒标签向右移动20缇EndSub2-5DimtmpPrivateSubCommand1_Click()'“复制”按钮Text1.SetFocus'焦点定位在文本框Text1tmp=Text1.SelText'将选中的内容存放在变量tmp中EndSubPrivateSubCommand2_Click()'“剪切”按钮tmp=Text1.SelText'将选中的内容存放在变量tmp中Text1.SelText='将选中的内容置为空串Text1.SetFocus'焦点定位在文本框Text1EndSubPrivateSubCommand3_Click()'“粘贴”按钮Text1.SelText=tmp'将变量tmp的值赋给文本框选中的内容Text1.SetFocus'焦点定位在文本框Text1EndSubPrivateSubCommand4_Click()'“下划线”按钮Text1.FontUnderline=NotText1.FontUnderline'设置或取消下划线EndSubPrivateSubCommand5_Click()'“删除线”按钮Text1.FontStrikethru=NotText1.FontStrikethru'设置或取消删除线EndSubPrivateSubCommand6_Click()'“加粗”按钮Text1.FontBold=NotText1.FontBold'设置或取消加粗线EndSubPrivateSubCommand7_Click()'“倾斜”按钮Text1.FontItalic=NotText1.FontItalic'设置或取消倾斜EndSubPrivateSubCommand8_Click()'“放大”按钮Text1.FontSize=Text1.FontSize+5'字体放大5磅EndSubPrivateSubCommand9_Click()'“缩小”按钮Text1.FontSize=Text1.FontSize-5'字体缩小5磅EndSubP38#2-8PrivateSubForm_Load()'在开始运行时设置各文本框的文字大小和字体Text2.FontName=隶书Text2.FontSize=16Text3.FontName=楷体_GB2312Text3.FontSize=18EndSubPrivateSubText1_Change()'在Text1中改变内容时改变Text2和Text3的内容Text2.Text=Text1.Text家电维修社团整理-2-更多精彩,静待家电维修Text3.Text=Text1.TextEndSubPrivateSubCommand1_Click()'清除按钮Text1.Text=EndSubPrivateSubCommand2_Click()'退出按钮EndEndSub2-9PrivateSubCommand1_Click()Command1.Visible=FalseCommand2.Visible=TrueLabel1.BorderStyle=1EndSubPrivateSubCommand2_Click()Command1.Visible=TrueCommand2.Visible=FalseLabel1.BorderStyle=0EndSubPrivateSubCommand3_Click()Command3.Visible=FalseCommand4.Visible=TrueLabel1.BackStyle=1EndSubPrivateSubCommand4_Click()Command3.Visible=TrueCommand4.Visible=FalseLabel1.BackStyle=0EndSubP60/613-1PrivateSubCommand1_Click()Constpi=3.1415926535898DimhAsSingleDimrAsSingleh=Val(Text1.Text)r=Val(Text2.Text)Text3.Text=Format(pi*r^2,0.000)Text4.Text=Format(2*pi*r*h,0.000)Text5.Text=Format(pi*r^2*h,0.000)EndSub3-2PrivateSubCommand1_Click()RandomizeText1.Text=Int(Rnd*100+1)Text2.Text=Int(Rnd*100+1)Text3.Text=EndSubPrivateSubCommand2_Click()Text3.Text=Val(Text1.Text)+Val(Text2.Text)EndSub3-4PrivateSubTimer1_Timer()y=Year(Date)'求当前日期的年份mon=Month(Date)'求当前日期的月份d=Day(Date)'求当前日期是月份中的第几天Label1.Caption=y&年&mon&月&d&日'将年、月、日串接起来h=Hour(Time)'求当前时间的小时部分Min=Minute(Time)'求当前时间的分钟部分s=Second(Time)'求当前时间的秒部分Label2.Caption=h&时&Min&分&s&秒'将时、分、秒串接起来EndSubP684-4OptionExplicitPrivateSubCommand1_Click()家电维修社团整理-3-更多精彩,静待家电维修DimAAsSingle,BAsSingle,CAsSingleDimPAsSingle,SAsSingleA=Val(Text1.Text)B=Val(Text2.Text)C=Val(Text3.Text)P=(A+B+C)/2S=Sqr(P*(P-A)*(P-B)*(P-C))Label2.Caption=Format(Str(S),0.00)'显示时保留两位小数EndSubP76#4-1PrivateSubCommand1_Click()ZJ.Text=Val(DJ.Text)*Val(SL.Text)EndSubPrivateSubCommand2_Click()EndEndSub4-3PrivateSubCommand1_Click()X=Val(Text1.Text)X1=X*3.1416/180SX=Abs(Sin(X1))CX=Abs(Cos(X1))Text2.Text=Text2.Text&_Format(X,0.000)&&_Format(SX,0.000)&&_Format(CX,0.000)&Chr(13)&Chr(10)Text1.SetFocusText1.SelStart=0Text1.SelLength=Len(Text1.Text)EndSub4-4PrivateSubForm_Click()h=Val(InputBox(请输入小时,将时间转换成秒,0))m=Val(InputBox(请输入分,将时间转换成秒,0))s=Val(InputBox(请输入秒,将时间转换成秒,0))Total=h*3600+m*60+sPrinth;小时;m;分;s;秒=;Total;秒EndSubP89@5-5PrivateSubText1_Change()Label2.Caption=EndSubPrivateSubText1_KeyUp(KeyCodeAsInteger,ShiftAsInteger)StaticIAsInteger'变量I统计输入错误口令的次数IfKeyCode=13Then'如果按下的键为回车键IfUCase(Text1.Text)=HELLOThen'如果口令为HELLOLabel2.Caption=恭喜!,您已成功进入本系统ElseIfI=0OrI=1Then'如果口令错且错误次数少于2I=I+1Label2.Caption=口令错!,请重新输入Text1.SelStart=0Text1.SelLength=Len(Text1.Text)Else'如果口令错且错误次数等于2MsgBox对不起,您不能使用本系统End'退出应用程序。EndIfEndIfEndSubP92#5-1PrivateSubCommand1_Click()x=Val(Text1.Text)IfxMod3=0AndxMod5=0AndxMod7=0ThenText2.Text=能同时被3、5、7整除ElseText2.Text=不能整除EndSub5-2PrivateSubForm_Load()DimxAsSingle,yAsSingle,zAsSingle,maxAsSingle,min家电维修社团整理-4-更多精彩,静待家电维修AsSinglex=InputBox(第一个)y=InputBox(第二个)z=InputBox(第三个)IfxyThenmax=xElse:max=yEndIfIfmaxzThenmax=zw=MsgBox(最大值&max)EndIfIfxyThenmin=xElse:min=yEndIfIfminzThenmin=zw=MsgBox(最小值&min)EndIfText1.Text=maxText2.Text=minEndSub5-6PrivateSubCommand1_Click()x=Val(Text1.Text)SelectCasexCaseIs0,Is100Label2.Caption=MsgBox输入的数据超出范围,请重新输入Text1.SetFocusText1.SelStart=0Text1.SelLength=Len(Text1.Text)CaseIs=90Label2.Caption=优CaseIs=80Label2.Caption=良CaseIs=70Label2.Caption=中CaseIs=60Label2.Caption=及格CaseElseLabel2.Caption=不及格EndSelectEndSub5-7DimIAsIntegerPrivateSubCommand1_Click()kl=UCase(Trim(Text1.Text))Ifkl=ABCDThenI=0Form2.ShowElseIfI=2ThenMsgBox对不起,您不能使用本系统EndElseForm1.Caption=口令错,请重新输入I=I+1Text1.SetFocusText1.SelStart=0Text1.SelLength=Len(Text1.Text)EndIfEndIfEndSubPrivateSubText1_Change()Form1.Caption=口令检测EndSubPrivateSubText1_KeyUp(KeyCodeAsInteger,ShiftAsInteger)IfKeyCode=13Then家电维修社团整理-5-更多精彩,静待家电维修kl=UCase(Trim(Text1.Text))Ifkl=ABCDThenI=0Form2.ShowElseIfI=2ThenMsgBox对不起,您不能使用本系统EndEl