请计算机高手帮我做做这几道VB程序设计题,关乎我的计算机成绩,万分感谢!!

2024-12-21 10:20:22
推荐回答(2个)
回答1:

1'1、在名称为Form1的窗体上建立一个名称为Cmd1,
'宽度为1500,高度为500,标题为"显示"的命令按钮
'(如图所示),编写适当的事件过程。要求程序运行后,
'如果单击"显示"命令按钮,则在窗体上显示"祝你考试成功"。

Option Explicit

Private Sub Cmd1_Click()
Print "祝你考试成功"
End Sub

Private Sub Form_Load()
Cmd1.Width = 1500
Cmd1.Height = 500
Cmd1.Caption = "显示"
Me.AutoRedraw = True

End Sub
----------------------

'2,输入圆的半径 , 求圆的周长和面积?

Option Explicit

Private Sub Form_Load()
Me.AutoRedraw = True
Dim banjing As Double
Dim mianji As Double
Dim zhouchang As Double
Dim PI As Double
PI = 3.14159265
banjing = InputBox("请输入半径!")

mianji = PI * PI * banjing
zhouchang = banjing * 2 * PI
Print "面积="; mianji
Print "周长="; zhouchang

End Sub
------------------------

'3在窗体上画一个名称为Text1的文本框,然后画三个单选按钮,
'并用这三个单选按钮建立一个控件数组,名称为Option1,程序
'运行后,如果单击某个单选按钮,则文本框中的字体将根据所
'选择的单选按钮切换。

Option Explicit

Private Sub Form_Load()
Dim i As Long
Option1(0).Caption = "宋体"
Option1(1).Caption = "隶书"
Option1(2).Caption = "黑体"
Text1.FontSize = "20"
Text1.Text = "字体变化!!!请你看!!!!!"

End Sub

Private Sub Option1_Click(Index As Integer)
Select Case Index

Case 1
Text1.FontName = "隶书"
Case 2
Text1.FontName = "黑体"

Case 0
Text1.FontName = "宋体"
End Select
End Sub
-------------------------------------

'4

Option Explicit

Private Sub C1_Click()
Dim showCaption As String
showCaption = "我的爱好是"
If Ch1(0).Value <> 0 Then
showCaption = showCaption & "体育"
End If
If Ch1(1).Value <> 0 Then
showCaption = showCaption & "音乐"
End If
If Ch1(2).Value <> 0 Then
showCaption = showCaption & "美术"
End If
Me.Caption = showCaption

End Sub

Private Sub Form_Load()
Ch1(0).Caption = "体育"
Ch1(1).Caption = "音乐"
Ch1(2).Caption = "美术"
C1.Caption = "显示"

End Sub

----------------------------

'5

Option Explicit

Private Sub Form_Load()
Me.AutoRedraw = True
Dim i As Long
Dim j As Long
For i = 1 To 7 Step 2
For j = 1 To i
Print "A";
Next j
Print
Next i
For i = 7 To 1 Step -2
For j = 1 To i
Print "B";
Next j
Print
Next i

End Sub

----------------------------------

其他两题,你自己想吧!!!!!

或者新开题目问吧!!!!!!!!

回答2:

1'1、在名称为Form1的窗体上建立一个名称为Cmd1,
'宽度为1500,高度为500,标题为"显示"的命令按钮
'(如图所示),编写适当的事件过程。要求程序运行后,
'如果单击"显示"命令按钮,则在窗体上显示"祝你考试成功"。

Option Explicit

Private Sub Cmd1_Click()
Print "祝你考试成功"
End Sub

Private Sub Form_Load()
Cmd1.Width = 1500
Cmd1.Height = 500
Cmd1.Caption = "显示"
Me.AutoRedraw = True

End Sub