c#课程设计图片管理系统.docx

上传人:b****1 文档编号:767661 上传时间:2023-04-30 格式:DOCX 页数:46 大小:145.16KB
下载 相关 举报
c#课程设计图片管理系统.docx_第1页
第1页 / 共46页
c#课程设计图片管理系统.docx_第2页
第2页 / 共46页
c#课程设计图片管理系统.docx_第3页
第3页 / 共46页
c#课程设计图片管理系统.docx_第4页
第4页 / 共46页
c#课程设计图片管理系统.docx_第5页
第5页 / 共46页
c#课程设计图片管理系统.docx_第6页
第6页 / 共46页
c#课程设计图片管理系统.docx_第7页
第7页 / 共46页
c#课程设计图片管理系统.docx_第8页
第8页 / 共46页
c#课程设计图片管理系统.docx_第9页
第9页 / 共46页
c#课程设计图片管理系统.docx_第10页
第10页 / 共46页
c#课程设计图片管理系统.docx_第11页
第11页 / 共46页
c#课程设计图片管理系统.docx_第12页
第12页 / 共46页
c#课程设计图片管理系统.docx_第13页
第13页 / 共46页
c#课程设计图片管理系统.docx_第14页
第14页 / 共46页
c#课程设计图片管理系统.docx_第15页
第15页 / 共46页
c#课程设计图片管理系统.docx_第16页
第16页 / 共46页
c#课程设计图片管理系统.docx_第17页
第17页 / 共46页
c#课程设计图片管理系统.docx_第18页
第18页 / 共46页
c#课程设计图片管理系统.docx_第19页
第19页 / 共46页
c#课程设计图片管理系统.docx_第20页
第20页 / 共46页
亲,该文档总共46页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

c#课程设计图片管理系统.docx

《c#课程设计图片管理系统.docx》由会员分享,可在线阅读,更多相关《c#课程设计图片管理系统.docx(46页珍藏版)》请在冰点文库上搜索。

c#课程设计图片管理系统.docx

c#课程设计图片管理系统

信息与电气工程学院

课程设计说明书

(200/200学年第学期)

课程名称:

软件程序设计课程设计

题目:

图片管理器

专业班级:

物联网工程1201班

学生姓名:

刘铭

学号:

指导教师:

赵辉

设计周数:

第十九周

设计成绩:

2015年1月9日

1.需求分析

由于对于现在使用电脑的大部份用户来说,在进行图片查看浏览的时候都会用到图片管理器,而对于图片的处理大部份也都是一些具有专业图片处理知识的人才会做的。

对于一些特别的观看效果来说,我们用一些专业的看图软件是高射炮打蚊子,仅仅为了看图而用这样一些软件是不合算的,我们必须花费一些时间去学习这些软件,因为越是功能强大的软件,往往使用起来越复杂。

这是一个很现实的规律。

对于一般的用户来说,他们说不定连这个软件都不知道。

我们需要一个简单实用的图片管理器来进行浏览、管理。

本软件为一个简单而且很实用的图片查看工具,不但可以进行图片的一些简单查看,浏览操作,而且还可以进行用户登录、分类、增删等功能,是一款比较适合广大普通用户和非计算机专业的用户的图片查看软件,本软件不但界面简洁,功能齐全,而且操作简单。

是款比较容易操作,实用的图片管理软件。

我们从用户角度,把软件功能的实现变得简单,易于操作。

2.开发与运行环境

开发环境:

WindowsXP、Windows7

开发工具:

MicrosoftVisualstudio2010C#、SQL2008

运行环境:

WindowsXP/7

2.系统设计

3.1.系统流程

3.2.功能模块

3.详细设计

4.1.登陆界面

本系统采用“用户—账号—数据库”一体模式,做到用户登录以后能够浏览与管理的图片及相册都为私人所有,以确保隐私安全。

4.2.主界面

菜单栏按钮除了有图标及名称以外,鼠标悬停一秒自动显示提示,主体部分左侧目录列表与缩略图显示区域之间边框位置可调。

单击选中列表名称背景自动变蓝,并且在右侧缩略图显示区域显示该目录下的图片缩略图及图片名称,单击选中缩略图会有蓝色边框且支持多选。

新增目录时会有窗口提示填写新目录名称,后在目录列表里生成项,并且在系统文件夹下生成相应文件夹。

未选定目录情况下删除目录会提示选择一个目录,选定目录情况下删除目录时会有窗口提示操作不可逆是否确认,点击确认后完成删除操作。

未选定目录情况下导入图片下拉列表自动显示首个目录名称,选定目录情况下导入图片下拉列表显示所选定目录名称,也可即时选定。

支持bmp,jpg,gif,jpeg,ico格式图片。

用户可以选定某图片进行改名,若有图片重名将自动改名。

状态栏显示所选图片信息。

缩略图按比例缩小并在各框中居中显示。

导入图片时下方进度条显示进度鼠标形状为漏斗。

4.3.图片浏览界面

本界面与主界面为同一窗口,开始下方工具栏隐藏,双击缩略图进入图片浏览时上方工具栏隐藏显示下方工具栏。

鼠标悬停按钮一秒则显示提示。

播放幻灯片时可自行选择时间间隔,窗口小于图片大小时可拖动也可选择合适窗口大小显示。

5.调试分析

主界面打不开

出错原因及改正:

把lstFolder的SelectedIndexChanged事件的代码没注意写在了lvView

的SelectedIndexChanged中了…使得删除路径不对…导致操作时出现异常…

将两部分代码交换

每次运行时原先保存在lstFolder的文件不显示了

错误原因及改正:

要使得上次运行时保存在图片目录文件下的文件在下次运行时也直接显示在lstFolder中…需要在MainForm_Load方法里加上如下代码

6.课程设计总结

通过这次课程设计,实现了一个简单的图片管理系统,而我也对C#软件开发有了更深

一步的认识,不论从开始分析到后来编程再到最后调试,也学到了很多在课堂上没有学到的东西。

对于VisualStudio2010和SQL2008的使用也更加熟练。

系统中存在的一些不足和系统设计上存在的缺憾,说明自己在这些方面还有很多不足之处有待自己进一步学习、提高。

?

?

在本次课程设计中,赵师赵辉和同组同学给了我很大的指导帮助,从他们哪里我学到了很多,在此表示感谢!

7.参考文献

[1]邱锦伦VisualC#.NET程序设计教程清华大学出版社2006年4月

[2]刘金岭数据库系统及应用教程—SQLServer2008清华大学出版社2013年9月

[3]陈广C#程序设计基础教程与实训北京大学出版社2013年7月

8.附录

usingSystem;

using

usingSystem.Linq;

using

namespace图片管理器

{

staticclassProgram

{

[STAThread]

staticvoidMain()

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(newfrmLogin());

}

}

}

usingSystem;

using

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

using

usingSystem.IO;

usingSystem.Collections;

namespace图片管理器

{

publicpartialclassMainForm:

Form

{

publicMainForm()

{

InitializeComponent();

}

privatestringpath=Application.StartupPath+"\\图片目录";

privatePenboundPen=newPen(Color.Gainsboro);

privatePenselPen=newPen(Color.Blue,3);

privateSolidBrushtextBrush=newSolidBrush(Color.Black);

privateSolidBrushbgBrush;

privateStringFormatformat=newStringFormat();

privateBitmapbmpInPb;

privatePointmousePoint=newPoint();

privatePointpbPoint=newPoint();

privateboolcanDrag;

privateboolisDraging;

privateintbmpIndex;

privatevoidMainForm_Load(objectsender,EventArgse)

{

lvView.Dock=DockStyle.Fill;

tscbInterval.SelectedIndex=1;

ShowView();

bgBrush=newSolidBrush(lvView.BackColor);

statusStrip1.Items[0].Visible=false;

format.Alignment=StringAlignment.Center;

try

{

if(!

Directory.Exists(path))

{

Directory.CreateDirectory(path);

}

}

catch(Exceptionex)

{

MessageBox.Show(ex.Message,"错误",

MessageBoxButtons.OK,MessageBoxIcon.Error);

return;

}

DirectoryInfodir=newDirectoryInfo(path);

foreach(DirectoryInfodindir.GetDirectories())

{

Folderfolder=newFolder(Application.StartupPath,d.Name);

}

}

privatevoidForm1_Load(objectsender,EventArgse)

{

lvView.Dock=DockStyle.Fill;

bgBrush=newSolidBrush(lvView.BackColor);

statusStrip1.Items[0].Visible=false;

format.Alignment=StringAlignment.Center;

try

{

if(!

Directory.Exists(path))

{

Directory.CreateDirectory(path);

}

}

catch(Exceptionex)

{

MessageBox.Show(ex.Message,"错?

¨a误¨?

",

MessageBoxButtons.OK,MessageBoxIcon.Error);

return;

}

DirectoryInfodir=newDirectoryInfo(path);

foreach(DirectoryInfodindir.GetDirectories())//获取¨dir中D的ì目录

{

Folderfolder=newFolder(Application.StartupPath,d.Name);

}

}

privatevoidtoolStripButton1_Click(objectsender,EventArgse)

{

FrmCreateFolderfrmCreateFolder=newFrmCreateFolder(this.lstFolder);

try

{

frmCreateFolder.ShowDialog(this);

}

finally

{

frmCreateFolder.Dispose();

}

}

privatevoidtsbtnLoad_Click(objectsender,EventArgse)

{

FrmLoadPicfrmLoadPic=newFrmLoadPic(this.lstFolder,this.statusStrip1);

try

{

if(frmLoadPic.ShowDialog(this)==DialogResult.OK)

{

LoadToListView();

}

}

finally

{

frmLoadPic.Dispose();//销毁窗体

}

}

privatevoidlvView_DrawItem(objectsender,DrawListViewItemEventArgse)

{

if

{

return;

}

Graphicsg=e.Graphics;

Folderfolder=(Folder)lstFolder.SelectedItem;

Bitmap

RectanglebmpRect=Folder.GetRectFromBounds(bmp,e.Bounds);

bmpRect.Offset(0,1);

RectangleboundRect=Folder.GetRectFromBounds(101,101,e.Bounds);

RectangletextRect=newRectangle(e.Bounds.X+4,

g.DrawRectangle(boundPen,boundRect);

if((e.State&ListViewItemStates.Selected)!

=0)

{

g.DrawImage(bmp,bmpRect);

boundRect.Inflate(1,1);

g.DrawRectangle(selPen,boundRect);

}

else

{

g.DrawImage(bmp,bmpRect);

}

g.FillRectangle(bgBrush,textRect);

}

privatevoidLoadToListView()

{

Folderfolder=(Folder)lstFolder.SelectedItem;

lvView.BeginUpdate();

if(!

folder.IsLoaded)

{

folder.LoadImage();

}

foreach(DictionaryEntrydeinfolder.bmps)

{

string)de.Key);

}

lvView.EndUpdate();

}

privatevoidlstFolder_SelectedIndexChanged(objectsender,EventArgse)

{

if

{

return;

}

LoadToListView();

}//浏览

privatevoidShowView()

{

tsMain.Visible=true;

lstFolder.Visible=true;

splitter1.Visible=true;

lvView.Visible=true;

pbPic.Visible=false;

tsViewPic.Visible=false;

}

privatevoidShowImage()

{

tsMain.Visible=false;

lstFolder.Visible=false;

splitter1.Visible=false;

lvView.Visible=false;

pbPic.Visible=true;

tsViewPic.Visible=true;

}

privatevoidlvView_DoubleClick(objectsender,EventArgse)

{

Pointp=Control.MousePosition;

p=lvView.PointToClient(p);

ListViewHitTestInfoinfo=lvView.HitTest(p);

ShowImage();

}

privatevoidPaintImageInPb(stringbmpName)

{

Folderfolder=(Folder)lstFolder.SelectedItem;

if(bmpInPb!

=null)

{

bmpInPb.Dispose();

}

bmpInPb=folder.GetImage(bmpName);

statusStrip1.Items[1].Text="名称:

êo"+bmpName+"尺寸?

êo"+

"x"+

pbPic.Image=bmpInPb;

MatchImage();

}

privatevoidMatchImage()

{

if(tsbtnNormal.Checked)

{//正常显示模式

pbPic.Dock=DockStyle.None;

pbPic.SizeMode=PictureBoxSizeMode.AutoSize;

pbPic.Left=(panel1.Width-pbPic.Width)/2;

pbPic.Top=(panel1.Height-pbPic.Height)/2;

if(pbPic.Width>panel1.Width||pbPic.Height>panel1.Height)

{//图像的长或宽大于显示边框时

canDrag=true;

pbPic.Cursor=Cursors.Hand;//改变鼠标指针样式

}

else

{//图像小于显示边框则不允许拖a动

canDrag=false;

pbPic.Cursor=Cursors.Default;

}

}

else

{

canDrag=false;

pbPic.Cursor=Cursors.Default;

if(bmpInPb.Width>panel1.Width||bmpInPb.Height>panel1.Height)

{

pbPic.Dock=DockStyle.Fill;

pbPic.SizeMode=PictureBoxSizeMode.Zoom;

}

else

pbPic.Dock=DockStyle.None;

pbPic.SizeMode=PictureBoxSizeMode.AutoSize;

pbPic.Left=(panel1.Width-pbPic.Width)/2;

pbPic.Top=(panel1.Height-pbPic.Height)/2;

}

}

privatevoidtsbtnMatch_Click(objectsender,EventArgse)

{

ToolStripButtonbtn=(ToolStripButton)sender;

if(btn.Checked)

{

return;

}

tsbtnNormal.Checked=false;

tsbtnMatch.Checked=false;

btn.Checked=true;

MatchImage();

}

privatevoidpbPic_MouseDown(objectsender,MouseEventArgse)

{

if(e.Button!

=MouseButtons.Left)

{

return;

}

isDraging=true;

mousePoint.X=e.X;

mousePoint.Y=e.Y;

pbPoint.X=pbPic.Left;

pbPoint.Y=pbPic.Top;

}

privatevoidpbPic_MouseMove(objectsender,MouseEventArgse)

{

if(!

isDraging||!

canDrag)

{

return;

}

intx=pbPic.Left;

if(pbPic.Width>panel1.Width)

{

x+=e.X-mousePoint.X;

if(x>0)

{

x=0;

}

elseif(x+pbPic.Width

{

x=panel1.Width-pbPic.Width;

}

}

inty=pbPic.Top;

if(pbPic.Height>panel1.Height)

{

y+=e.Y-mousePoint.Y;

if(y>0)

{

y=0;

}

elseif(y+pbPic.Height

{

y=panel1.Height-pbPic.Height;

}

}

pbPic.Left=x;

pbPic.Top=y;

}

privatevoidpbPic_MouseUp(objectsender,MouseEventArgse)

{

if(e.Button!

=MouseButtons.Left)

{

return;

}

isDraging=false;

}

privatevoidtsbtnReturn_Click(objectsender,EventArgse)

{

timer1.Stop();

pbPic.Image=null;

if(bmpInPb!

=null)

{

bmpInPb.Dispose();

}

ShowView();

}

privatevoidtsbtnPeriod_Click(objectsender,EventArgse)

{

if(bmpIndex==0)

{

}

else

{

bmpIndex--;

}

ListViewItemitem=lvView.Items[bmpIndex];

PaintImageInPb(item.Text);

}

privatevoidtsbtnNext_Click(objectsender,EventArgse)

{

if

{

bmpIndex=0;

}

else

{

bmpIndex++;

}

ListViewItemitem=lvView.Items[bmpIndex];

PaintImageInPb(item.Text);

}

privatevoidsbtnAntoPlay_Click(objectsender,EventArgse)

{

timer1.Enabled=!

timer1.Enabled;

tsbtnAutoPlay.Checked=timer1.Enabled;

}

privatevoidtscbInterval_SelectedIndexChanged(objectsender,EventArgse)

{

timer1.Interval=(int)(Math.Pow(2,tscbInterval.SelectedIndex)*1000);

}

privatevoidtimer1_Tick(objectsender,EventArgse)

{

tsbtnNext_Click(null,null);

}

privatevoidtoolStripButton5_Click(objectsender,EventArgse)

{

Close();

}

privatevoidtsbtnDelFolder_Click(object

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2