实例介绍
【实例简介】
1、程序运行环境
VS2005 SQL2000或SQL2005
2、数据库安装
打开数据库管理系统,附加数据库即可。
3、本程序开发时连接的数据库服务器是本地(local),而且能够以Windows集成安全方式访问。
4、程序登录密码为
管理员:
用户名:heshan 密码:123456
用户名:zhaojia 密码:123456
超级管理员:
用户名:wenjie 密码:123456
【实例截图】
【核心代码】
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Library.UserInterface
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class MainForm : System.Windows.Forms.Form
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.Button btnReader;
private System.Windows.Forms.Button btnBook;
private System.Windows.Forms.Button btnPublishing;
private System.Windows.Forms.Button btnBorrow;
private System.Windows.Forms.Button btnUser;
private System.Windows.Forms.Button btnQuery;
private System.Windows.Forms.Button btnExit;
private string userName;
private Label label1;
private string userSort;
public MainForm(string username,string usersort)
{
InitializeComponent();
this.userName=username;
userSort=usersort;
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.btnReader = new System.Windows.Forms.Button();
this.btnBook = new System.Windows.Forms.Button();
this.btnPublishing = new System.Windows.Forms.Button();
this.btnBorrow = new System.Windows.Forms.Button();
this.btnUser = new System.Windows.Forms.Button();
this.btnQuery = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnReader
//
this.btnReader.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnReader.ForeColor = System.Drawing.Color.White;
this.btnReader.Location = new System.Drawing.Point(159, 160);
this.btnReader.Name = "btnReader";
this.btnReader.Size = new System.Drawing.Size(80, 30);
this.btnReader.TabIndex = 9;
this.btnReader.TabStop = false;
this.btnReader.Text = "读者信息";
this.btnReader.UseVisualStyleBackColor = false;
this.btnReader.Click = new System.EventHandler(this.btnReader_Click);
//
// btnBook
//
this.btnBook.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBook.ForeColor = System.Drawing.Color.White;
this.btnBook.Location = new System.Drawing.Point(159, 213);
this.btnBook.Name = "btnBook";
this.btnBook.Size = new System.Drawing.Size(80, 30);
this.btnBook.TabIndex = 10;
this.btnBook.Text = "图书信息";
this.btnBook.Click = new System.EventHandler(this.btnBook_Click);
//
// btnPublishing
//
this.btnPublishing.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnPublishing.ForeColor = System.Drawing.Color.White;
this.btnPublishing.Location = new System.Drawing.Point(279, 160);
this.btnPublishing.Name = "btnPublishing";
this.btnPublishing.Size = new System.Drawing.Size(80, 30);
this.btnPublishing.TabIndex = 11;
this.btnPublishing.Text = "出版社信息";
this.btnPublishing.Click = new System.EventHandler(this.btnPublishing_Click);
//
// btnBorrow
//
this.btnBorrow.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBorrow.ForeColor = System.Drawing.Color.White;
this.btnBorrow.Location = new System.Drawing.Point(159, 290);
this.btnBorrow.Name = "btnBorrow";
this.btnBorrow.Size = new System.Drawing.Size(80, 30);
this.btnBorrow.TabIndex = 12;
this.btnBorrow.Text = "读者借还书";
this.btnBorrow.Click = new System.EventHandler(this.btnBorrow_Click);
//
// btnUser
//
this.btnUser.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnUser.ForeColor = System.Drawing.Color.White;
this.btnUser.Location = new System.Drawing.Point(279, 213);
this.btnUser.Name = "btnUser";
this.btnUser.Size = new System.Drawing.Size(80, 30);
this.btnUser.TabIndex = 13;
this.btnUser.Text = "管理员信息";
this.btnUser.Click = new System.EventHandler(this.btnUser_Click);
//
// btnQuery
//
this.btnQuery.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnQuery.ForeColor = System.Drawing.Color.White;
this.btnQuery.Location = new System.Drawing.Point(279, 290);
this.btnQuery.Name = "btnQuery";
this.btnQuery.Size = new System.Drawing.Size(80, 30);
this.btnQuery.TabIndex = 15;
this.btnQuery.Text = "综合查询";
this.btnQuery.Click = new System.EventHandler(this.btnQuery_Click);
//
// btnExit
//
this.btnExit.BackColor = System.Drawing.Color.DodgerBlue;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.ForeColor = System.Drawing.Color.White;
this.btnExit.Location = new System.Drawing.Point(404, 358);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(80, 30);
this.btnExit.TabIndex = 16;
this.btnExit.Text = "退出系统";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click = new System.EventHandler(this.btnExit_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
this.label1.Location = new System.Drawing.Point(75, 66);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(365, 35);
this.label1.TabIndex = 17;
this.label1.Text = "欢迎进入图书管理系统";
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.ClientSize = new System.Drawing.Size(522, 453);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnQuery);
this.Controls.Add(this.btnUser);
this.Controls.Add(this.btnBorrow);
this.Controls.Add(this.btnPublishing);
this.Controls.Add(this.btnBook);
this.Controls.Add(this.btnReader);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "图书管理系统";
this.Load = new System.EventHandler(this.MainForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
/*static void Main()
{
Application.Run(new MainForm("andy","andy"));
}*/
private void btnExit_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void MainForm_Load(object sender, System.EventArgs e)
{
this.Text="图书馆管理系统 " userName;
if(this.userSort=="system")
{
this.btnUser.Enabled=true;
}
else
{
this.btnUser.Enabled=false;
}
}
private void btnQuery_Click(object sender, System.EventArgs e)
{
Form QueryForm=new Query();
QueryForm.ShowDialog();
}
private void btnUser_Click(object sender, System.EventArgs e)
{
Form UserForm=new User();
UserForm.ShowDialog();
}
private void btnReader_Click(object sender, System.EventArgs e)
{
Form readerForm=new Reader();
readerForm.ShowDialog();
}
private void btnBook_Click(object sender, System.EventArgs e)
{
Form bookForm=new Book();
bookForm.ShowDialog();
}
private void btnBorrow_Click(object sender, System.EventArgs e)
{
Form bookForm=new BorrowReturn();
bookForm.ShowDialog();
}
private void btnPublishing_Click(object sender, System.EventArgs e)
{
Form publisForm=new Publishing();
publisForm.ShowDialog();
}
}
}
相关软件
网友评论
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明


支持(0) 盖楼(回复)