14.PictureBox

本视频主要介Picture Box控件。
1.SizeMode属性。
默认情况下,在 Normal 模式中,Image 置于 PictureBox 的左上角,凡是因过大而不适合 PictureBox 的任何图像部分都将被剪裁掉。使用 StretchImage 值会使将图像拉伸,以便适合 PictureBox 的大小。 使用 AutoSize 值会使控件调整大小,以便总是适合图像的大小。使用 CenterImage 值会使图像居于工作区的中心。
2.BorderStyle属性
用switch语句完成。
Fixed3 3维边框
FixedSingle 单边框
None 无
3.initialize picturebox
代码:
pictureBox1.ErrorImage=Properties.Rresources.error;//在图像加载过程中发生错误或图像加载取消时要显示的 Image
pictureBox1.InitialImage=Properties.Resource.Loading;//在加载主图像时显示在图片框控件中的 Image
4.在资源中添加图片
在properties中的图片添加所需的图片。

5.背景图片BackgroundImage属性
pictureBox1.BackgroundImage = Properties.Resources.backgroud;
6打开某网页上的图片
ImageLocation属性
pictureBox1.ImageLocation = http://www.zsu.edu.cn;//要在 PictureBox 中显示的图像的路径

7.装载本地图片
string fileLoadation=String.Empty;
 fileLoadation = System.Environment.GetFolderPath(Environment.SpecialFolder);
 fileLoadation += "\\logo.gif";
 pictureBox1.ImageLocation = fileLoadation;

posted on 2008-02-24 15:03  爱你的人  阅读(635)  评论(0)    收藏  举报