|登录 |注册

查看: 4919|回复: 21
打印 上一主题 下一主题

(分享) Visual c# 教學

[复制链接]
狂天使
2011-6-2 11:30 AM
本帖最后由 狂天使 于 2011-6-2 11:36 AM 编辑

最近本人在學C#, 也希望這份文章能幫到想學C#的朋友。

也希望各位大大給些指教哦!

Lesson 1 : Create a windows form and  First Program
Go to http://www.microsoft.com/express/Downloads/ download the visual C# 2010 Express

1)  Click the new project


2) Choose Windows Form Application and Click Ok at the bottom

3) Introduce some basic tools



A) Toolbox: Use to design the Windows Form (Ctrl+W+X)
B) Solution Explorer: Can see the Project u create (Ctrl+W+S)
C) Properties:  Windows form properties (Ex: change font size, Name, size, etc) (Ctrl+W+P)
D) Start Debugging: Use to debug the project you create. (F5)

4) Now start our first program

A) Go to the toolbox -> Common Controls -> Button drag to the form. You can use your mouse  
           resize the button directly or go to Properties->Size to resize your button. The 1st value is width
          2nd value is height.



B) Double Click the button1 on Windows Form. Type this [MessageBox.Show(“Hello World”);] in the
     button_Click. If you want to know more detail of [MessageBox.Show] can surf this link
     http://msdn.microsoft.com/library/default.aspx . [MessageBox.Show] Display a message  
     box .(Simple Explain)



C) Click the Start Debugging(F5), and click the button1 it will appear the MessageBox Hello World. The result will same to above picture.

5) The Project will Store in Document-> Visual Studio 2010 -> Project. You can change your location also, go to File->Save All or CTRL+SHIFT+S.

Name: The Project Name
Location: The location that you store the project.

6) So how to let the project be .exe file (.exe file can directly run the program on the Windows).
1) After saving the project you can go to the Menu Bar Debug->Build Solution (F6) then will  
     generate the .exe file.
2) The .exe file will store in the “Your Project folder”->bin->Debug after generate. Double Click
     the .exe file, it will directly run the program.



END

英文也不是很好,如果Grammar 有錯的話也可以指針我。謝謝各位!
david6629
2011-6-2 02:52 PM
加油=]
狂天使
2011-6-2 07:17 PM
Lesson 2: GUI Design

1) Start the new project Windows Forms Application


2) Design the GUI of the Windows of Application, can use the toolbox to design.


   A) Design the button (Toolbox->Common Control-> button) Click and drag on the windows form
   B)  Design the check box (Toolbox->Common Control-> check box ) Click and drag on the windows form


C) Design the Menu Bar (Toolbox-> Menu & Toolbars -> MenuStrip) Click and drag on the windows form you can type the name you want in the column.


D) Design the Status strip at bottom (Toolbox-> Menu & Toolbars -> Status_Strip) Click and drag on the windows form , have the drop down list after click the status strip button.



END
宅男-兜着走
2011-6-2 07:37 PM
不喜欢 winform, 喜欢 WPF 多一点。 比较接近网页的写法。
用起来比较舒服。
Johnlai
2011-6-3 05:16 AM
想请问下这个和vb的分别在哪里啊?也是window form的~感觉很相似哦
~Zero
2011-6-3 10:33 AM
不喜欢 winform, 喜欢 WPF 多一点。 比较接近网页的写法。
用起来比较舒服。
宅男-兜着走 发表于 2011-6-2 07:37 PM

给初学者的话,还是 winform 比较适合做教学。
~Zero
2011-6-3 10:35 AM
想请问下这个和vb的分别在哪里啊?也是window form的~感觉很相似哦
Johnlai 发表于 2011-6-3 05:16 AM

其实大同小异的。coding syntax 和一些 built-in library 不同而已。
宅男-兜着走
2011-6-4 12:14 AM
回复 6# ~Zero


    当考虑使用一个技术来做production 的时候, 就要想这些控件, language 适不适合用在你的IDEA 上。
然而我觉得winform 很难下。 不花些时间, 不投点钱买component, 很难作出好的东西。

虽然 drag and drop 是很好

不过他会那么快遗忘一定是有某些原因的。==
Grazio-int
2011-6-4 05:03 PM
多谢分享。
goodhermit95
2011-6-4 11:11 PM
我用WPF的时候,想要用一些class library,就没有...
您需要登录后才可以回帖 登录 | 注册

JBTALKS.CC |联系我们 |隐私政策 |Share

GMT+8, 2026-4-28 02:43 AM , Processed in 0.099394 second(s), 26 queries .

Powered by Discuz! X2.5 © 2001-2012 Comsenz Inc.

本论坛言论纯属发表者个人意见,与本论坛立场无关
Copyright © 2003-2012 JBTALKS.CC All Rights Reserved

Dedicated Server powered by iCore Technology Sdn. Bhd.

合作联盟网站:
JBTALKS 马来西亚中文论坛 | JBTALKS我的空间 | ICORE TECHNOLOGY SDN. BHD.
回顶部