宜昌爱格假日酒店:请问用C语言怎么完整地编出这样简易的东西来啊?

来源:百度文库 编辑:高校问答 时间:2024/05/11 15:52:27
有一个介面,上面有三个文本框,两个是输入的,一个是输出的,有三个按钮,一个是求和,一个是清空,一个是退出.怎么把介面编出来(编出来的程序要可以用的)?
放在windows中运行的.本人刚学C,什么GUI,MFC类等等都不知道是什么,希望各位哥们说清楚一点

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

Public Sub New()
MyBase.New()

'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()

'在 InitializeComponent() 调用之后添加任何初始化

End Sub

'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer

'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(40, 240)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(88, 40)
Me.Button1.TabIndex = 0
Me.Button1.Text = "求和"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(40, 96)
Me.TextBox1.Multiline = True
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(120, 48)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = "TextBox1"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(208, 96)
Me.TextBox2.Multiline = True
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(136, 48)
Me.TextBox2.TabIndex = 2
Me.TextBox2.Text = "TextBox2"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(376, 80)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(112, 48)
Me.Label1.TabIndex = 3
Me.Label1.Text = "Label1"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(176, 240)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(72, 40)
Me.Button2.TabIndex = 4
Me.Button2.Text = "清空"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(320, 240)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(88, 48)
Me.Button3.TabIndex = 5
Me.Button3.Text = "推出"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(560, 363)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = TextBox1.Text + TextBox2.Text
If Not IsNumeric(TextBox1.Text) Then
MsgBox("必须输入数字!", , "警告")
TextBox1.Text = ""
TextBox2.Text = ""

End If

End Sub

Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub

Private Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
End
End Sub
End Class

注意:最好在VB.Net 2003调试或支持VB.Net软件

C的话几乎做不到 除非DOS下的准GUI
用C++吧
推荐C++ Builder
跟vb一样方便

用MFC类

http://gzyiyu.com/