資源簡介
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個文件信息
- 上一篇:C#做的簡單的Undo、Redo功能的實現
- 下一篇:房屋售價的數據集kaggle
評論
共有 條評論