Evo. G Tech Team Forum
Welcome to Evo. G Tech Team Forum. We have moved to a new website : www.evogtechteam.com

Thanks you.

by Evo. G Tech Team Management.

Join the forum, it's quick and easy

Evo. G Tech Team Forum
Welcome to Evo. G Tech Team Forum. We have moved to a new website : www.evogtechteam.com

Thanks you.

by Evo. G Tech Team Management.
Evo. G Tech Team Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

1-4 Adding a Textbox to the Form

Go down

1-4 Adding a Textbox to the Form Empty 1-4 Adding a Textbox to the Form

Post by Henley September 10th 2014, 18:09

Adding a Tool (Control) to your Form


我们首先把Textbox添加到Form里面做为这堂课的开始。先在Toolbox的列表找到"Common Controls",在当中找寻Textbox工具,然后双击Textbox,一个文本框就会在你的Form里出现。

[You must be registered and logged in to see this image.]

Textbox一来是添加在Form的左上角。如果想要移动它,你只需用你的滑鼠按着它不放,然后把它拉到别的位置就可以了。
你是否察觉到Textbox的周围都有一个正方体?它们是sizing handles,用于控制Textbox的尺寸。你可以尝试按着其中一个正方体,然后拉一拉它,Textbox的形状改变了。你也可以自己试着调整Textbox的大小直到你满意为止,都没问题!

说到这里,你应该也发现好像少了什么东西对吧?你只能够把你的Textbox拉长去左右,却不能拉高它的长度!怎么会这样呢?那是因为,Textbox只允许容纳一行的文字,就因为Textbox只能包含一行字体,所以我们就不能改变它的高度咯。不过不要紧,这没什么重要,我们先暂时忽略掉这个部分!
好,接下来我们要做的,就是多添加两个Textbox进你的Form里,只需像刚才那样,双击两次Textbox,把它们拉到第一个Textbox的下面,给Textbox彼此留点空间,把全部Textbox调整成一样的形状,就像下图那样:

[You must be registered and logged in to see this image.]

或者你可以用简单一点的方法,右键单击你的第一个Textbox选择Copy,然后Paste在Form里的空白处。再用同样的方法添加第三个Textbox就行了。 
那么添加Textbox的任务就告一段落,接着让我们一起来看看如何添加Label好不好   cheers



Adding a Label to your Form


所谓Label就是含有标签的用途,以上的Textbox看起来一模一样,根本就分不清那个是那个,我们就来给它们标签好了!如你所料,添加Label的步骤都和添加Textbox的方法相同。在Toolbox列表里找到Label工具,双击它,它也和Textbox一样出现在Form的左上角。

[You must be registered and logged in to see this image.]

移动Label的话也一样,按着它然后拉到别的地方。你先试试把你的第一个Label移到第一个Textbox的旁边。好了再用刚才所学到的方式添加其他的Label,然后分别把它们放在还没标签的Textbox身旁。看看你的Form是不是和我的一样呢?

[You must be registered and logged in to see this image.]

现在让我们来看看你的program长什么样子了。点击Debug菜单,选取Start Debugging,或者直接在键盘上按下F5也行!

[You must be registered and logged in to see this image.]

如果要停止程序运行,点击Form的右上角一个红色的“X”;或在Debug菜单中选取Stop Debugging;或在键盘上敲下Shift+F5,任你选。

[You must be registered and logged in to see this image.]

还是你也可以点击在VB的工具栏里的Stop按钮,如下图:
[You must be registered and logged in to see this image.]

那么到目前为止,你的Form已经有Textbox和Label,看起来像是可以让用户填写的表格了。但你的Label都还没换名字,人家怎么知道该填写什么东西在你的Textbox里呢?别担心,我们下一堂课就来讨论这个话题!

下课咯!(@^ - ^@)

2014-09-10
19:51:56
Henley
Henley
Sponsor
Sponsor

Posts : 55
Points : 75949
Reputation : 0
Join date : 2014-01-05

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum