图书管理系统源代码毕业论文.docx
《图书管理系统源代码毕业论文.docx》由会员分享,可在线阅读,更多相关《图书管理系统源代码毕业论文.docx(122页珍藏版)》请在冰豆网上搜索。
图书管理系统源代码毕业论文
登录窗体代码:
ImportsSystem.Data.SqlClient
PublicClassFormDengLu
DimbiaozhiAsBoolean
PrivateSubButtonDengLu_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesButtonDengLu.Click
sqlconn.ConnectionString="userid=sa;password=;initialcatalog=新华电脑学校图书管理系统;datasource=(local)"
sqlconn.Open()
DimsqlcommAsNewSqlCommand
DimsqldsAsNewDataSet
DimsqldaptAsNewSqlDataAdapter
sqlcommmandText="select*fromuserinfowhereusername='"&TextBoxYongHu.Text&"'andpassword='"&TextBoxMiMa.Text&"'"
sqlcomm.Connection=sqlconn
sqldapt.SelectCommand=sqlcomm
sqldapt.Fill(sqlds,"userinfo")
Ifsqlds.Tables("userinfo").Rows.Count=0Then
IfMessageBox.Show("用户名或密码错误","错误提示",MessageBoxButtons.OK,MessageBoxIcon.Error)=Windows.Forms.DialogResult.OKThen
TextBoxYongHu.Text=""
TextBoxMiMa.Text=""
sqlconn.Close()
EndIf
Else
biaozhi=True
Me.Close()
FormZhuJieMian.ToolStripStatusLabel2.Text=Me.TextBoxYongHu.Text
EndIf
EndSub
PrivateSubFormDengLu_FormClosing(ByValsenderAsObject,ByValeAsSystem.Windows.Forms.FormClosingEventArgs)HandlesMe.FormClosing
Ifbiaozhi=FalseThen
End
EndIf
EndSub
PrivateSubFormDengLu_Shown(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesMe.Shown
TextBoxYongHu.Focus()
Me.PictureBox1.Image=NewBitmap(Application.StartupPath&"\picture\denglu.jpg")
Me.BackgroundImage=NewBitmap(Application.StartupPath&"\picture\backgroudimage.jpg")
Label1.Image=NewBitmap(Application.StartupPath&"\picture\backgroudimage.jpg")
Label1.Text="用户登录提示:
"&vbCrLf&vbCrLf&"系统默认用户名"&vbCrLf&vbCrLf&"admin,密码admin"
Label1.Image=NewBitmap(Application.StartupPath&"\picture\backgroudimage.jpg")
GroupBox1.BackgroundImage=NewBitmap(Application.StartupPath&"\picture\backgroudimage.jpg")
EndSub
PrivateSubButtonTuiChu_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButtonTuiChu.Click
End
EndSub
EndClass
版本说明窗体代码:
PublicClassFormBanBenShuoMing
PrivateSubLinkLabel1_LinkClicked(ByValsenderAsSystem.Object,ByValeAsSystem.Windows.Forms.LinkLabelLinkClickedEventArgs)HandlesLinkLabel1.LinkClicked
System.Diagnostics.Process.Start("hi.baidu./ylinuxs")
EndSub
PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.Click
Me.Close()
EndSub
EndClass
打印窗体代码:
PublicClassFormTuShuDaYin
PublicbiaoziAsBoolean
PrivateSubButtonYeMianSheZhi_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButtonYeMianSheZhi.Click
PageSetupDialog1.Document=PrintDocument1
PageSetupDialog1.ShowDialog()
EndSub
PrivateSubButtonYuLan_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButtonYuLan.Click
PrintPreviewDialog1.Document=PrintDocument1
PrintPreviewDialog1.ShowDialog()
EndSub
PrivateSubButtonDaYin_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButtonDaYin.Click
PrintDialog1.Document=PrintDocument1
PrintDialog1.AllowSomePages=True
PrintDialog1.AllowCurrentPage=True
PrintDialog1.AllowSelection=True
IfPrintDialog1.ShowDialog=Windows.Forms.DialogResult.OKThen
PrintDocument1.Print()
EndIf
EndSub
PrivateSubButtonYeMeiJiao_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButtonYeMeiJiao.Click
FormYeMeiJiao.ShowDialog()
EndSub
PrivateSubPrintDocument1_PrintPage(ByValsenderAsSystem.Object,ByValeAsSystem.Drawing.Printing.PrintPageEventArgs)HandlesPrintDocument1.PrintPage
Dimw,h,x,yAsInteger
DimPrintHeightAsInteger
DimPrintLeft,PrintTopAsInteger
DimCellWidth,CellheightAsInteger
DimkAsInteger
DimiAsInteger
StaticjAsInteger
Ifbiaozi=TrueThen
IfFormYeMeiJiao.TextBoxYeMei.Text<>""Then
w=e.PageBounds.Width
h=e.MarginBounds.Top
y=h/2-FormYeMeiJiao.TextBoxYeMei.Font.Height/2
x=w/2-(FormYeMeiJiao.TextBoxYeMei.TextLength*FormYeMeiJiao.TextBoxYeMei.Font.Height)/2
e.Graphics.DrawString(FormYeMeiJiao.TextBoxYeMei.Text,FormYeMeiJiao.TextBoxYeMei.Font,Brushes.Blue,x,y)
EndIf
IfFormYeMeiJiao.TextBoxYeJiao.Text<>""Then
w=e.PageBounds.Width
h=e.PageBounds.Height-e.MarginBounds.Bottom
y=h/2-FormYeMeiJiao.TextBoxYeJiao.Font.Height/2+e.MarginBounds.Bottom
x=w/2-(FormYeMeiJiao.TextBoxYeJiao.TextLength*FormYeMeiJiao.TextBoxYeJiao.Font.Height)/2
e.Graphics.DrawString(FormYeMeiJiao.TextBoxYeJiao.Text,FormYeMeiJiao.TextBoxYeJiao.Font,Brushes.Blue,x,y)
EndIf
PrintTop=e.MarginBounds.Top
PrintLeft=e.MarginBounds.Left
Fork=0ToFormTuShuGuanLi.DataGridView1.Columns.Count-1
e.Graphics.DrawString(FormTuShuGuanLi.DataGridView1.Columns(k).HeaderText,FormTuShuGuanLi.DataGridView1.Font,Brushes.Red,PrintLeft,PrintTop)
CellWidth=FormTuShuGuanLi.DataGridView1.Columns(k).Width
Cellheight=FormTuShuGuanLi.DataGridView1.ColumnHeadersHeight
e.Graphics.DrawRectangle(Pens.Blue,PrintLeft,PrintTop,CellWidth,Cellheight)
PrintLeft=PrintLeft+FormTuShuGuanLi.DataGridView1.Columns(k).Width
Next
PrintTop=PrintTop+FormTuShuGuanLi.DataGridView1.ColumnHeadersHeight
PrintHeight=FormTuShuGuanLi.DataGridView1.ColumnHeadersHeight
'i列下标的变化围,j行下标的变化围
DoWhilej<=FormTuShuGuanLi.DataGridView1.Rows.Count-1
PrintLeft=e.MarginBounds.Left
Cellheight=FormTuShuGuanLi.DataGridView1.Rows(j).Height
Fori=0ToFormTuShuGuanLi.DataGridView1.Columns.Count-1
CellWidth=FormTuShuGuanLi.DataGridView1.Columns(i).Width
e.Graphics.DrawString(FormTuShuGuanLi.DataGridView1.Rows(j).Cells(i).Value,FormTuShuGuanLi.DataGridView1.Font,Brushes.Black,PrintLeft,PrintTop)
e.Graphics.DrawRectangle(Pens.Blue,PrintLeft,PrintTop,CellWidth,Cellheight)
PrintLeft=PrintLeft+FormTuShuGuanLi.DataGridView1.Columns(i).Width
Next
PrintHeight=PrintHeight+FormTuShuGuanLi.DataGridView1.Rows(j).Height
PrintTop=PrintTop+FormTuShuGuanLi.DataGridView1.Rows(j).Height
j=j+1
IfPrintHeight>=e.MarginBounds.HeightThen
ExitDo
EndIf
Loop
Ifj<=FormTuShuGuanLi.DataGridView1.Rows.Count-1Then
e.HasMorePages=True
Else
e.HasMorePages=False
j=0
EndIf
Else
'Dimw,h,x,yAsInteger
IfFormYeMeiJiao.TextBoxYeMei.Text<>""Then
w=e.PageBounds.Width
h=e.MarginBounds.Top
y=h/2-FormYeMeiJiao.TextBoxYeMei.Font.Height/2
x=w/2-(FormYeMeiJiao.TextBoxYeMei.TextLength*FormYeMeiJiao.TextBoxYeMei.Font.Height)/2
e.Graphics.DrawString(FormYeMeiJiao.TextBoxYeMei.Text,FormYeMeiJiao.TextBoxYeMei.Font,Brushes.Blue,x,y)
EndIf
IfFormYeMeiJiao.TextBoxYeJiao.Text<>""Then
w=e.PageBounds.Width
h=e.PageBounds.Height-e.MarginBounds.Bottom
y=h/2-FormYeMeiJiao.TextBoxYeJiao.Font.Height/2+e.MarginBounds.Bottom
x=w/2-(FormYeMeiJiao.TextBoxYeJiao.TextLength*FormYeMeiJiao.TextBoxYeJiao.Font.Height)/2
e.Graphics.DrawString(FormYeMeiJiao.TextBoxYeJiao.Text,FormYeMeiJiao.TextBoxYeJiao.Font,Brushes.Blue,x,y)
EndIf
'DimPrintHeightAsInteger
'DimPrintLeft,PrintTopAsInteger
PrintTop=e.MarginBounds.Top
PrintLeft=e.MarginBounds.Left
'DimCellWidth,CellheightAsInteger
'DimkAsInteger
Fork=0ToFormDuZheGuanLi.DataGridView1.Columns.Count-1
e.Graphics.DrawString(FormDuZheGuanLi.DataGridView1.Columns(k).HeaderText,FormDuZheGuanLi.DataGridView1.Font,Brushes.Red,PrintLeft,PrintTop)
CellWidth=FormDuZheGuanLi.DataGridView1.Columns(k).Width
Cellheight=FormDuZheGuanLi.DataGridView1.ColumnHeadersHeight
e.Graphics.DrawRectangle(Pens.Blue,PrintLeft,PrintTop,CellWidth,Cellheight)
PrintLeft=PrintLeft+FormDuZheGuanLi.DataGridView1.Columns(k).Width
Next
PrintTop=PrintTop+FormDuZheGuanLi.DataGridView1.ColumnHeadersHeight
PrintHeight=FormDuZheGuanLi.DataGridView1.ColumnHeadersHeight
'DimiAsInteger
'StaticjAsInteger
'i列下标的变化围,j行下标的变化围
DoWhilej<=FormDuZheGuanLi.DataGridView1.Rows.Count-1
PrintLeft=e.MarginBounds.Left
Cellheight=FormDuZheGuanLi.DataGridView1.Rows(j).Height
Fori=0ToFormDuZheGuanLi.DataGridView1.Columns.Count-1
CellWidth=FormDuZheGuanLi.DataGridView1.Columns(i).Width
e.Graphics.DrawString(FormDuZheGuanLi.DataGridView1.Rows(j).Cells(i).Value,FormDuZheGuanLi.DataGridView1.Font,Brushes.Black,PrintLeft,PrintTop)
e.Graphics.DrawRectangle(Pens.Blue,PrintLeft,PrintTop,CellWidth,Cellheight)
PrintLeft=PrintLeft+FormDuZheGuanLi.DataGridView1.Columns(i).Width
Next
PrintHeight=PrintHeight+FormDuZheGuanLi.DataGridView1.Rows(j).Height
PrintTop=PrintTop+FormDuZheGuanLi.DataGridView1.Rows(j).Height
j=j+1
IfPrintHeight>=e.MarginBounds.HeightThen
ExitDo
EndIf
Loop
Ifj<=FormDuZheGuanLi.DataGridView1.Rows.Count-1Then
e.HasMorePages=True
Else
e.HasMorePages=False
j=0
EndIf
EndIf
EndSub
PrivateSubButtonQuXiao_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButtonQuXiao.Click
Me.Close()
EndSub
EndClass
读者查询打印窗体代码:
PublicClassFormDuZheChaXunDaYin
PublicbiaoziAsBoolean
PrivateSubButtonYeMianSheZhi_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButtonYeMianSheZhi.Click
PageSetupDialog1.Document=PrintDocument1
PageSetupDialog1.ShowDialog()
EndSub
PrivateSubButtonYuLan_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButtonYuLan.Click
PrintPreviewDialog1.Document=PrintDocument1
PrintPreviewDialog1.ShowDialog()
EndSub
PrivateSubButtonDaYin_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButtonDaYin.Click
PrintDialog1.Document=PrintDocument1
PrintDialog1.AllowSomePages=True
PrintDialog1.AllowCurrentPage=True
PrintDialog1.AllowSelection=True
IfPrintDialog1.ShowDialog=Windows.Forms.DialogResult.OKThen
PrintDocument1.Print()
EndIf
EndSub
PrivateSubButtonYeMeiJiao_Click(ByValsenderAsSystem.Object,ByValeAs