Step by Step 用 C# 做出一個 GUI 的應用程式

這是我在 MSDN 網站上,看到的一篇文章
這篇文章一步一步的引領你如何使用 C# 來寫作 GUI 應用程式.
我覺得很實用
http://msdn.microsoft.com/library/en-us/dnmag01/html/winforms.asp
這篇文章主要是假設你有 Visual Studio.Net beta 1 整合開發環境來引領的
不過如果沒有 vs.net beta 1 的話,可以用 .Net Framework beta 1 來實作
如果使用 .Net Framework beta 2 的話,有幾點要注意:
1.編譯時所引用的 Dynamic Link Library 有變化
這是文章所建議的編譯方法,即 beta 1:
csc /target:winexe /out:Hello.exe /reference:System.dll
/reference:System.WinForms.dll /reference:System.Drawing.dll
/reference:Microsoft.Win32.Interop.dll Hello.cs
beta 2 的編譯方法改變了, 以下是我試出來的結果:
csc /target:winexe /out:Hello.exe /reference:System.dll
/reference:System.Windows.Forms.dll /reference:System.Drawing.dll Hello.cs
主要是 beta 2 將 DLL 的架構做了一些調整
2.using 的架構:
beta 1 是
using System;
using System.WinForms;
using System.Drawing;
而 beta 2 是
using System;
using System.Windows.Forms;
using System.Drawing;
其實這邊主要是跟 1 有關係,在beta 1 你可以試著尋找 System.WinForms.dll, 你將會發現有這麼一個檔案;但是在 beta 2 中卻沒有, beta 2 中只有System.Windows.Forms.dll.
3.MessageBox 類別有變化,其實應該也是因為架構調整的關係吧
beta 1:
MessageBox.Show (String.Format (“{0} is not ” +
“a valid image file”, fileName), “Error”,
MessageBox.OK | MessageBox.IconError);
beta 2:
MessageBox.Show (String.Format (“{0} is not ” +
“a valid image file”, fileName), “Error”,
MessageBoxButtons.OK,MessageBoxIcon.Error);
其他應該還有很多有所調整, 可能要參考 .Net Framework 的說明才能得知囉.