23. 24. 25. 26. winform.showtrue 27. win.loopMessage 28. return winform复制代码不同:1.AAuto 用“”号链接字符串与变量VB 用“amp”2.关闭窗口:AAuto 用 winform.closeVB 用 Me.Close3.AAuto 用 win.msgbox打开消息窗口 VB 用 MessageBox.Show4.AAuto 每段结束尾部有“”号而 VB 没有.4.2 变量需求:定义一个数字变量 27把 27 加 1;最后用对话框显示 27 加 1 的结果。
VB.NET 1. 2. Public Class Form1 3. Private Sub btnAdd_ClickByVal sender As System.Object ByVal e As System.EventArgs Handles btnAdd.Click 4. Dim n As Integer 5. n 27 6. n n 1 7. MessageBox.ShowquotValue of n1 quot amp n quotVariablesquot 8. End Sub 9. End Class复制代码AAuto 1. 2. import win //必须首先导入 win 窗口支持库 3. import win.ui 4. import win.ui.menu 5. import win.ole 6. /DSG/ 7. var winform win.formparent... min1bottom249max1right349textquotAAuto FormquotclsquotAAU_FORMquot 8. winform.add 9. btnAdd bottom140textquotAdd 1 to nquotleft123right225top108fontLOGFONT namequotSimSunquoth-12 z0 clsquotbuttonquot 10. 11. // 12. 13. winform.btnAdd.oncommand functionidevent 14. //win.msgbox winform.btnAdd.text 15. n27 16. nn1 17. win.msgboxquotValue of n 1 quot n quotVariablesquot 18. 19. //endproc 20. 21. winform.showtrue 22. win.loopMessage 23. return winform复制代码不同:1. 快手不用定义变量3.4 数据类型AAuto 中的基本数据类型分为: quotnullquot quotbooleanquot quotpointerquot quotnumberquotquotstringquot quottablequot quotfunctionquot quotcdataquot quotcontextquotquotclassquotVS2010 的帮助文档:Visual Basic → 参考 → Visual Basic 语言参考 → 数据类型摘要VB数字类型又分为:整型Integer和浮点型浮点型又分为:单精度Single与双精度Double3.4.1 常见的整型数学运算需求:整数的加减乘除运算 16 加 8,输出结果;结果继续减 2,输出结果;再乘 10,输出结果最后除 6,输出结果VB.NET 1. 2. Public Class Form1 3. Private Sub Button1_ClickByVal sender As System.Object ByVal e As System.EventArgs Handles Button1.Click 4. Dim n As Integer 5. n 16 6. n n 8 7. MessageBox.Showquot加法测试...quot amp n quot整数运算quot 8. n n - 2 9. MessageBox.Showquot减法测试...quot amp n quot整数运算quot 10. n n 10 11. MessageBox.Showquot乘法测试...quot amp n quot整数运算quot 12. n n / 6 13. MessageBox.Showquot除法测试...quot amp n quot整数运算quot 14. End Sub 15. End Class复制代码AAuto 1. import win //必须首先导入 win 窗口支持库 2. import win.ui 3. import win.ui.menu 4. import win.ole 5. /DSG/ 6. var winform win.formparent... min1bottom249max1textquotAAuto Formquotright349clsquotAAU_FORMquot 7. winform.add 8. button bottom142textquotbuttonquotleft127right201top113fontLOG FONT namequotSimSunquoth-12 z0clsquotbuttonquot 9. 10. // 11. winform.button.oncommand functionidevent 12. //win.msgbox winform.button.text 13. n 16 14. n n8 15. win.msgboxquot加法测试...quot n quot整数运算quot 16. n n-2 17. win.msgboxquot减法测试...quot n quot整数运算quot 18. n n10 19. win.msgboxquot乘法测试...quot n quot整数运算quot 20. n n/6 21. win.msgboxquot除法测试...quot n quot整数运算quot 22. 23. winform.showtrue; 24. win.loopMessage 25. return winform复制代码总结:AAuto 与 VB 的加减乘除-/符号相同同时 AAuto 和 VB 都支持简写运算如:n 8n - 2n 10n / 6不同:n / 6AAuto 结果是 36.666666666667而 VB 的结果是整数 37应当是说 AAuto 是动态类型的,也可以用 var 关键字声明局部变量,但不需要指明类型。
实际上上面的 vb.net 代码并不完整,他还有一个 Form1.Designer.vb 1. ltGlobal.Microsoft.VisualBasic.CompilerServices.DesignerGeneratedgt _ 2. Partial Class Form1 3. Inherits System.Windows.Forms.Form 4. 5. Form 重写 Dispose,以清理组件列表。
6. ltSystem.Diagnostics.DebuggerNonUserCodegt _ 7. Protected Overrides Sub DisposeByVal disposing As Boolean 8. Try 9. If disposing AndAlso components IsNot Nothing Then 10. components.Dispose 11. End If 12. Finally 13. MyBase.Disposedisposing 14. End Try 15. End Sub 16. 17. Windows 窗体设计器所必需的 18. Private components As System.ComponentModel.IContainer 19. 20. 注意: 以下过程是 Windows 窗体设计器所必需的 21. 可以使用 Windows 窗体设计器修改它。
22. 不要使用代码编辑器修改它。
23. ltSystem.Diagnostics.DebuggerStepThroughgt _ 24. Private Sub InitializeComponent 25. Me.Button1 New System.Windows.Forms.Button 26. Me.SuspendLayout 27. 28. Button1 29. 30. Me.Button1.Location New System.Drawing.Point61 94 31. Me.Button1.Name quotButton1quot 32. Me.Button1.Size New System.Drawing.Size110 46 33. Me.Button1.TabIndex 0 34. Me.Button1.Text quotButton1quot 35. Me.Button1.UseVisualStyleBackColor True 36. 37. Form1 38. 39. Me.AutoScaleDimensions New System.Drawing.SizeF6.0 13.0 40. Me.AutoScaleMode System.Windows.Forms.AutoScaleMode.Font 41. Me.ClientSize New System.Drawing.Size292 266 42. Me.Controls.AddMe.Button1 43. Me.Name quotForm1quot 44. Me.Text quotForm1quot 45. Me.ResumeLayoutFalse 46. 47. End Sub 48. Friend WithEvents Button1 As System.Windows.Forms.Button 49. 50. End Class复制代码而下面是 AAuto 窗体设计器生成的代码。
与传统语言看上去全然不一样: 1. /DSG/ 2. 3. var winform win.formparent... min1bottom249max1right349textquotAAuto FormquotclsquotAAU_FORMquot 4. 5. winform.add 6. 7. btnAdd bottom140textquotAdd 1 to nquotleft123right225top108fontLOGFONT namequotSimSunquoth-12 z0 clsquotbuttonquot 8. 9. 10. 11. //复制代码AAuto 的 UI 库与传统的 UI 库有较大的区别,在 VC,VB 中的一套机制宠大晦涩,可能用了VB 几年也搞不懂 windows 的消息机制,实际我认为在一定程度上把简单的事情搞复杂了。
因为过度的封装带来了一些弊端。
AAuto 只是进行了简单的封装,一开始不适应,熟悉了就会得心应手,对 windows 消息机制本来的面目可以非常的熟悉。
AAuto 的 UI 库与传统的 UI 库有较大的区别,在 VC,VB 中的一套机制宠大晦涩,可能用了VB 几年也搞不懂 windows 的消息机制,实际我认为在一定程度上把简单的事情搞复杂了。
因为过度的封装带来了一些弊端。
AAuto 只是进行了简单的封装,一开始不适应,熟悉了就会得心应手,对 windows 消息机制本来的面目可以非常的熟悉。
acrane 发表于 2010-7-13 16:00:00谢谢一鹤解答,AAuto 代码看似长了一些,但粘过来就能运行,但 VB 的不行,还需要自己补充控件。
对于 Windows
上一篇:
kernel 源代码
下一篇:
国外高校后勤用工现状及存在问题研究University Logistics Research question the status quo and the presence of foreign l