求一道VB题的答案啊。
编程题1.在窗体上建立一个标签,当单击窗体时,在标签上显示“你单击了窗体”;当双击窗体时,在标签上显示“你双击了窗体”2、设计应用程序,要求在窗体上输出如图13所示的简单...
编程题1.在窗体上建立一个标签,当单击窗体时,在标签上显示“你单击了窗体”;当双击窗体时,在标签上显示“你双击了窗体” 2、设计应用程序,要求在窗体上输出如图13所示的简单图形,窗体不可改变大小。当单击“清屏”按钮,清除窗体上显示的图形,同时,命令按钮显示为“单击窗体退出”且移至窗体左上角改变为原大小的两倍;单击窗体后退出应用程序。 解答题:1.简述用VB创建应用程序的基本步骤。
展开
2个回答
展开全部
第一题
Private Sub Form_Click()
Me.Label1.Caption = "你单击了窗体"
End Sub
Private Sub Form_DblClick()
Me.Label1.Caption = "你双击了窗体"
End Sub
第二题
Private Sub Command1_Click()
If Me.Command1.Caption = "清屏" Then
Me.Cls
Me.Command1.Caption = "单击窗体后退出"
Me.Command1.Left = 0
Me.Command1.Top = 0
Me.Command1.Width = 2 * Me.Command1.Width
Me.Command1.Height = 2 * Me.Command1.Height
Else
End
End If
End Sub
Private Sub Form_Activate()
For i = 1 To 4
For j = 1 To 6
If j = 6 - i Then
Print " ";
Else
Print "★";
End If
Next
Print
Next
End Sub
Private Sub Form_Click()
If Me.Command1.Caption = "单击窗体后退出" Then
End
End If
End Sub
同时需要修改窗体的BorderStyle属性为1
第三题
先添加控件创建界面,然后再为控件添加代码
Private Sub Form_Click()
Me.Label1.Caption = "你单击了窗体"
End Sub
Private Sub Form_DblClick()
Me.Label1.Caption = "你双击了窗体"
End Sub
第二题
Private Sub Command1_Click()
If Me.Command1.Caption = "清屏" Then
Me.Cls
Me.Command1.Caption = "单击窗体后退出"
Me.Command1.Left = 0
Me.Command1.Top = 0
Me.Command1.Width = 2 * Me.Command1.Width
Me.Command1.Height = 2 * Me.Command1.Height
Else
End
End If
End Sub
Private Sub Form_Activate()
For i = 1 To 4
For j = 1 To 6
If j = 6 - i Then
Print " ";
Else
Print "★";
End If
Next
Next
End Sub
Private Sub Form_Click()
If Me.Command1.Caption = "单击窗体后退出" Then
End
End If
End Sub
同时需要修改窗体的BorderStyle属性为1
第三题
先添加控件创建界面,然后再为控件添加代码
展开全部
编程题1.在窗体上建立一个标签,当单击窗体时,在标签上显示“你单击了窗体”;当双击窗体时,在标签上显示“你双击了窗体”
Private Sub Form_Click()
Label1.Caption = "你单击了窗体"
End Sub
Private Sub Form_DblClick()
Label1.Caption = "你双击了窗体"
End Sub
2、设计应用程序,要求在窗体上输出如图13所示的简单图形,窗体不可改变大小。当单击“清屏”按钮,清除窗体上显示的图形,同时,命令按钮显示为“单击窗体退出”且移至窗体左上角改变为原大小的两倍;单击窗体后退出应用程序。
Private Sub Command1_Click()
If Command1.Caption = "清屏" Then
Me.Cls
Command1.Caption = "单击窗体退出"
Command1.Move 0, 0, Command1.Width * 2, Command1.Height * 2
End If
End Sub
Private Sub Form_Click()
Unload Me
End Sub
Private Sub Form_Load()
'在属性面板中调整:
'设置窗体的BorderStyle属性为 1或者3
'设置窗体的ControlBox属性为false
Me.AutoRedraw = True
Print Tab(2); String(4, "★"); Spc(4); String(1, "★")
Print Tab(2); String(3, "★"); Spc(4); String(2, "★")
Print Tab(2); String(2, "★"); Spc(4); String(3, "★")
Print Tab(2); String(1, "★"); Spc(4); String(4, "★")
Command1.Caption = "清屏"
End Sub
Private Sub Form_Click()
Label1.Caption = "你单击了窗体"
End Sub
Private Sub Form_DblClick()
Label1.Caption = "你双击了窗体"
End Sub
2、设计应用程序,要求在窗体上输出如图13所示的简单图形,窗体不可改变大小。当单击“清屏”按钮,清除窗体上显示的图形,同时,命令按钮显示为“单击窗体退出”且移至窗体左上角改变为原大小的两倍;单击窗体后退出应用程序。
Private Sub Command1_Click()
If Command1.Caption = "清屏" Then
Me.Cls
Command1.Caption = "单击窗体退出"
Command1.Move 0, 0, Command1.Width * 2, Command1.Height * 2
End If
End Sub
Private Sub Form_Click()
Unload Me
End Sub
Private Sub Form_Load()
'在属性面板中调整:
'设置窗体的BorderStyle属性为 1或者3
'设置窗体的ControlBox属性为false
Me.AutoRedraw = True
Print Tab(2); String(4, "★"); Spc(4); String(1, "★")
Print Tab(2); String(3, "★"); Spc(4); String(2, "★")
Print Tab(2); String(2, "★"); Spc(4); String(3, "★")
Print Tab(2); String(1, "★"); Spc(4); String(4, "★")
Command1.Caption = "清屏"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询