• 大小: 158KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-22
  • 语言: C#
  • 标签: C#  源代码  

资源简介

C#实现的电子相册源代码,能实现简单地载入。上下翻页等基本功能

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using System.Windows.Forms;
using System.Drawing;
using System.IO;
using DAL;

namespace BLL
{
    public class PhotoLogic
    {
        private Image img = null;
        private byte[] buff = null;
        private MemoryStream ms = null;
        private FileStream fs = null;
        private List allPhotos { get; set; }
        private PhotoAccess pa = null;

        public PhotoLogic() {
            pa = new PhotoAccess();
            Refresh();
        }

        //刷新
        public void Refresh()
        {
            allPhotos = pa.GetAllPhoto();
        }

       //上传
        public bool IsUpLoadSuccess(Photo pht)
        {
            return pa.UpLoadImage(pht);
        }


        //返回byte[]
        public byte[] GetFilebyte(string filePath)
        {            
            if(File.Exists(filePath)){
                fs = new FileStream(filePathFileMode.OpenFileAccess.Read);
                int fileLength = (int)fs.Length;
                buff = new byte[fileLength];
                fs.Read(buff0buff.Length);
                fs.Close();
                return buff;
            }
            return null;
        }

        public Image GetCertainImage(Photo pht)
        {       
            ms = new MemoryStream(pht.Img);
            img = Image.FromStream(ms);
            ms.Close();
            return img;
        }

        public Photo GetcertainPhoto(ref int picIndex char status)
        {
            if (status == ‘+‘)
            {
                picIndex++;
                if (picIndex >= allPhotos.Count)
                {
                    MessageBox.Show(“这是最后一张!“);
                    picIndex--;
                }
            }
            else
            {
                picIndex--;
                if (picIndex <= -1)
                {
                    MessageBox.Show(“这是第一张!“);
                    picIndex++;
                }
            }
            return allPhotos[picIndex];
        }


        //浏览图片
        public string ReturnPath(OpenFileDialog odlg){
            odlg.Filter = “图片文件(*.gif;*.jpg;*.bmp)|*.gif;*.jpg;*.bmp“;
            if(odlg.ShowDialog() == DialogResult.OK){
                return odlg.FileName;
            }
            return string.Empty;
        }

    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        897  2011-11-09 16:24  陈世平\陈世平\sqlcsp.sql

     文件       6656  2011-11-09 16:30  陈世平\陈世平\电子相册\BLL\bin\Debug\BLL.dll

     文件      15872  2011-11-09 16:30  陈世平\陈世平\电子相册\BLL\bin\Debug\BLL.pdb

     文件       7168  2011-11-09 16:30  陈世平\陈世平\电子相册\BLL\bin\Debug\DAL.dll

     文件      17920  2011-11-09 16:30  陈世平\陈世平\电子相册\BLL\bin\Debug\DAL.pdb

     文件       5120  2011-11-09 14:52  陈世平\陈世平\电子相册\BLL\bin\Debug\Model.dll

     文件      13824  2011-11-09 14:52  陈世平\陈世平\电子相册\BLL\bin\Debug\Model.pdb

     文件       2803  2011-11-09 14:51  陈世平\陈世平\电子相册\BLL\BLL.csproj

     文件        819  2011-11-09 16:30  陈世平\陈世平\电子相册\BLL\obj\Debug\BLL.csproj.FileListAbsolute.txt

     文件       6656  2011-11-09 16:30  陈世平\陈世平\电子相册\BLL\obj\Debug\BLL.dll

     文件      15872  2011-11-09 16:30  陈世平\陈世平\电子相册\BLL\obj\Debug\BLL.pdb

     文件       5962  2011-11-09 16:30  陈世平\陈世平\电子相册\BLL\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       5053  2011-11-09 16:30  陈世平\陈世平\电子相册\BLL\obj\Debug\ResolveAssemblyReference.cache

     文件       2511  2011-11-09 16:30  陈世平\陈世平\电子相册\BLL\PhotoLogic.cs

     文件       1362  2011-11-09 09:33  陈世平\陈世平\电子相册\BLL\Properties\AssemblyInfo.cs

     文件        881  2011-11-09 15:56  陈世平\陈世平\电子相册\BLL\UserLogic.cs

     文件       7168  2011-11-09 16:30  陈世平\陈世平\电子相册\DAL\bin\Debug\DAL.dll

     文件      17920  2011-11-09 16:30  陈世平\陈世平\电子相册\DAL\bin\Debug\DAL.pdb

     文件       5120  2011-11-09 14:52  陈世平\陈世平\电子相册\DAL\bin\Debug\Model.dll

     文件      13824  2011-11-09 14:52  陈世平\陈世平\电子相册\DAL\bin\Debug\Model.pdb

     文件       2632  2011-11-09 13:48  陈世平\陈世平\电子相册\DAL\DAL.csproj

     文件       2217  2011-11-09 15:27  陈世平\陈世平\电子相册\DAL\DBHelp.cs

     文件        643  2011-11-09 16:30  陈世平\陈世平\电子相册\DAL\obj\Debug\DAL.csproj.FileListAbsolute.txt

     文件       7168  2011-11-09 16:30  陈世平\陈世平\电子相册\DAL\obj\Debug\DAL.dll

     文件      17920  2011-11-09 16:30  陈世平\陈世平\电子相册\DAL\obj\Debug\DAL.pdb

     文件       5769  2011-11-09 16:30  陈世平\陈世平\电子相册\DAL\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1366  2011-11-09 16:13  陈世平\陈世平\电子相册\DAL\PhotoAccess.cs

     文件       1362  2011-11-09 09:34  陈世平\陈世平\电子相册\DAL\Properties\AssemblyInfo.cs

     文件        865  2011-11-09 15:56  陈世平\陈世平\电子相册\DAL\UserAccess.cs

     文件        447  2011-11-09 11:57  陈世平\陈世平\电子相册\Model\Adminstrator.cs

............此处省略88个文件信息

评论

共有 条评论