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

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

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

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

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

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;

namespace图片管理器

{

staticclassProgram

{

[STAThread]

staticvoidMain()

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(newfrmLogin());

}

}

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Text;

usingSystem.IO;

usingSystem.Collections;

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)

错?

¨

a误¨

"

foreach(DirectoryInfodindir.GetDirectories())//获取¨

dir中D的ì

目录

}

privatevoidtoolStripButton1_Click(objectsender,EventArgse)

FrmCreateFolderfrmCreateFolder=newFrmCreateFolder(this.lstFolder);

frmCreateFolder.ShowDialog(this);

finally

frmCreateFolder.Dispose();

privatevoidtsbtnLoad_Click(objectsender,EventArgse)

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

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

LoadToListView();

frmLoadPic.Dispose();

//销毁窗体

privatevoidlvView_DrawItem(objectsender,DrawListViewItemEventArgse)

if

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.FillRectangle(bgBrush,textRect);

privatevoidLoadToListView()

lvView.BeginUpdate();

folder.IsLoaded)

folder.LoadImage();

foreach(DictionaryEntrydeinfolder.bmps)

string)de.Key);

lvView.EndUpdate();

privatevoidlstFolder_SelectedIndexChanged(objectsender,EventArgse)

}//浏览

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)

if(bmpInPb!

=null)

bmpInPb.Dispose();

bmpInPb=folder.GetImage(bmpName);

statusStrip1.Items[1].Text="

名称:

ê

o"

+bmpName+"

尺寸?

+

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;

//改变鼠标指针样式

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

canDrag=false;

pbPic.Cursor=Cursors.Default;

if(bmpInPb.Width>

panel1.Width||bmpInPb.Height>

pbPic.Dock=DockStyle.Fill;

pbPic.SizeMode=PictureBoxSizeMode.Zoom;

privatevoidtsbtnMatch_Click(objectsender,EventArgse)

ToolStripButtonbtn=(ToolStripButton)sender;

if(btn.Checked)

tsbtnNormal.Checked=false;

tsbtnMatch.Checked=false;

btn.Checked=true;

privatevoidpbPic_MouseDown(objectsender,MouseEventArgse)

if(e.Button!

=MouseButtons.Left)

isDraging=true;

mousePoint.X=e.X;

mousePoint.Y=e.Y;

pbPoint.X=pbPic.Left;

pbPoint.Y=pbPic.Top;

privatevoidpbPic_MouseMove(objectsender,MouseEventArgse)

isDraging||!

canDrag)

intx=pbPic.Left;

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>

y+=e.Y-mousePoint.Y;

if(y>

y=0;

elseif(y+pbPic.Height<

y=panel1.Height-pbPic.Height;

pbPic.Left=x;

pbPic.Top=y;

privatevoidpbPic_MouseUp(objectsender,MouseEventArgse)

isDraging=false;

privatevoidtsbtnReturn_Click(objectsender,EventArgse)

timer1.Stop();

pbPic.Image=null;

privatevoidtsbtnPeriod_Click(objectsender,EventArgse)

if(bmpIndex==0)

bmpIndex--;

ListViewItemitem=lvView.Items[bmpIndex];

PaintImageInPb(item.Text);

privatevoidtsbtnNext_Click(objectsender,EventArgse)

bmpIndex=0;

bmpIndex++;

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