您的位置:首页 > 其它

WinForm基本控件的用法

2010-07-16 16:17 204 查看
1.ListBox 控件

方法:add();向Items里面添加值ListBox1.Items.ADD();

AddRange():向Items添加一个数组ListBox1.Items.AddRange(new string[] {"111","222"});

clear(): 清空ListBox1里面的值 ListBox1.Items.Clear();

SetSelected("索引",bool true|false),是否选中。

count 获取总数

this.listBox1.Items[index],获取里面的值index为索引(从0开始的)

this.ListBox1.Selectedindex 选中值的索引

this.ListBox1.SelectedValue 选中的值

this.ListBox1.SelectedItem

this.ListBox1.SelectedItems[index]

2.picturebox 重要的属性就是image

this.pictureBox1.Image = Image.FromFile(Application.StartupPath+@"/1.jpg");

只能通过Image中的静态方法来实现,因为Image是个抽象类。Application.StartupPath:是可执行程序的路径.

3.设置一个窗体为MDI窗体

this.IsMdiContainer = true;

怎么把子窗体加载进来

Son s1 = new Son();//实例一个对象
s1.MdiParent = this;//指定他MDI容器为当前对象
s1.Show();//显示子窗体。

4.MenuStrip 做菜单栏。

5.statustrip地址栏
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: