窗体?对,现在总算开始有点像在看VB的文章了。不过我要说:大虾请重新来过。我们把Visual Studio.net自动生成的代码丢一边去,从零开始。其实到现在为止我一直都在用SnippetCompiler来写代码。干脆打开WindowsForm.vb好了。
首先是导入必要的命名空间: imports System imports System.Drawing imports Microsoft.VisualBasic imports System.Collections imports System.ComponentModel imports System.Windows.Forms
然后要定义主窗体。主窗体是一个类,从System.Windows.Forms.Form中继承: public class WindowsForm : inherits System.Windows.Forms.Form public sub New() end sub end class
然后是main函数: public module MyModule sub Main() Application.Run(new WindowsForm()) end sub end module
运行Debug菜单中的Start as WinForm,一个简单的窗体就出现了:

但是这个窗体太简单。
to be continued... 
|