.net俱乐部12月10日活动ppt及程序代码

这次活动主要为了吸引广大学生或者.net爱好者的兴趣而编写的一个图片浏览器,实现了“上一张”、“下一张”、“最后一张”、“第一张”的定位功能,并且使用了两种方式(利用PictureBox控件和绘制)来显示图片,还演示了如何将编译后的程序制作成安装包。
 
部分关键代码:
                 // 初始化图片装载路径
                 private void InitPath()
                ...{
                        path=System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures);
                }
/** //// <summary>
                 /// 根据指定好的路径装载图片
                 /// </summary>
                 /// <returns>返回包含符合条件的图片名称的ArrayList集合</returns>
                 public ArrayList LoadPicture()
                ...{
                         if(path== null)
                        ...{
                                InitPath();
                        }

                        ArrayList pictureList= new ArrayList();
                        System.IO.DirectoryInfo directoryInfo= new DirectoryInfo(path);
设置显示的图片类型为jpg、bmp、gif三种 #region 设置显示的图片类型为jpg、bmp、gif三种
                        FileInfo[] jpgFiles=directoryInfo.GetFiles( "*.jpg");
                        FileInfo[] bmpFiles=directoryInfo.GetFiles( "*.bmp");
                        FileInfo[] gifFiles=directoryInfo.GetFiles( "*.gif");
                        #endregion

                        FileInfo[] pictureFiles= new FileInfo[jpgFiles.Length+bmpFiles.Length+gifFiles.Length];
                        Array.Copy(jpgFiles,pictureFiles,jpgFiles.Length);
                        Array.Copy(bmpFiles,0,pictureFiles,jpgFiles.Length,bmpFiles.Length);
                        Array.Copy(gifFiles,0,pictureFiles,jpgFiles.Length+bmpFiles.Length,gifFiles.Length);

                         for ( int i = 0; i < pictureFiles.Length; i++)
                        ...{
                                pictureList.Add(pictureFiles[i].FullName);
                        }
                         return pictureList;
                }
 
程序源代码可以到 我的网站 去下载。

你可能感兴趣的:(职场,休闲)