C#软件项目的代码及窗口图.doc_第1页
C#软件项目的代码及窗口图.doc_第2页
C#软件项目的代码及窗口图.doc_第3页
C#软件项目的代码及窗口图.doc_第4页
C#软件项目的代码及窗口图.doc_第5页
已阅读5页,还剩43页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

软件项目代码及窗口图片1. 登录界面:窗口图片:代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using LostAndFound.主界面;using System.IO;using LostAndFound.类;namespace LostAndFound public partial class FLogin : Form public static DataSet UserDs; public static string LoginPasswork; public static string LoginUser; public static string MainFileName = ; public FLogin() InitializeComponent(); if (MainFileName = ) FileName fn = new FileName(); MainFileName = fn.FN(); StreamReader rd = File.OpenText(MainFileName +otherUser.txt); string s = rd.ReadLine(); string ss = s.Split (,); for (int i = 0; i ss.Length; i+) if (ssi != ) txtUser.Items.Add(ssi); private void service_Click(object sender, EventArgs e) LostAndFound.客服.service f = new LostAndFound.客服.service(); f.Show(); private void login_Click(object sender, EventArgs e) if (checkBox2.Checked) if (txtUser.Text.Trim() = | txtPw.Text.Trim() = ) MessageBox.Show(输入的账号或密码为空!); else if (checkBox1.Checked) if (txtUser.Items.Contains(txtUser.Text.Trim() else txtUser.Items.Remove(txtUser.Text.Trim(); txtUser.Items.Add(txtUser.Text.Trim(); StreamWriter sw = File.AppendText(MainFileName + otherUser.txt); string w = txtUser.Text.Trim() + ,; sw.Write(w); sw.Close(); else StreamWriter sw = new StreamWriter(MainFileName + otherUser.txt); string w = ,; sw.Write(w); sw.Close(); Sqlconnect con = new Sqlconnect(); UserDs =new DataSet() ; UserDs= con.GetDataFromDB(txtUser .Text.Trim(); if (UserDs != null) Encryption en = new Encryption(); if (en.UserMd5(txtPw.Text.Trim() = UserDs .Tables 0.Rows 0.ItemArray 1.ToString() ) frmMain f = new frmMain(); f.Show(); txtUser.Text = ; txtPw.Text = ; this.Hide(); else MessageBox.Show(请输入正确的账号和密码!, 错误); else MessageBox.Show(请同意相关条款后,再登录!); private void txtPw_KeyDown(object sender, KeyEventArgs e) if (e.KeyCode = Keys.Enter) login_Click( sender, e); private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) string path =MainFileName +othertest.htm; /测试一个htm文档 System.Diagnostics.Process.Start(path); /打开此文件。 private void FLogin_FormClosing(object sender, FormClosingEventArgs e) Application.Exit(); private void button1_Click(object sender, EventArgs e) LostAndFound.注册.FRegistered f = new LostAndFound.注册.FRegistered(); f.Show(); this.Hide(); 2. 注册界面:窗口图片:代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using LostAndFound.类;using System.IO;using setup.类;namespace LostAndFound.注册 public partial class FRegistered : Form string User = ; string UserName = ; string Sex = ; string Address = ; string PhoneNumber = ; string Birthdy=; string Introduce = ; string filePhotoName =; string photoName = ; string Password = ; string BankID = ; string CardID = ; string Question = ; string Answer = ; Image image =null; Image image2 = null; string MainFileName = FLogin.MainFileName; public FRegistered() InitializeComponent(); this.BackColor = Color.Empty; image = Image.FromFile(MainFileName + otherClickImage.png); private void button1_Click(object sender, EventArgs e) FLogin f = new FLogin(); f.Show(); this.Hide(); private void button3_MouseDown(object sender, MouseEventArgs e) button3.Image = image; private void button3_MouseUp(object sender, MouseEventArgs e) button3.Image = null; private void buttonGo_MouseDown(object sender, MouseEventArgs e) buttonGo.Image = image; private void buttonGo_MouseUp(object sender, MouseEventArgs e) buttonGo.Image = null; private void FRegistered_Load(object sender, EventArgs e) this.TransparencyKey = this.BackColor; private void button4_Click(object sender, EventArgs e) MessageBox.Show(抱歉!我们暂时没有官方首页!); private void button6_Click(object sender, EventArgs e) MessageBox.Show(抱歉!我们暂时没有商场充值!); private void button7_Click(object sender, EventArgs e) MessageBox.Show(抱歉!我们暂时没有软件论坛!); private void button8_Click(object sender, EventArgs e) LostAndFound.客服.service f = new LostAndFound.客服.service(); f.Show(); private void checkMen_Click(object sender, EventArgs e) if (checkMen.Checked = true) checkWomen.Checked = false; Sex = 男; private void checkWomen_CheckedChanged(object sender, EventArgs e) if (checkWomen.Checked = true) checkMen.Checked = false; Sex = 女; private void button1_Click_1(object sender, EventArgs e) try GetFileName get = new GetFileName(); filePhotoName = get.GetName(); photoName = get.FileName(); MessageBox.Show(你所选的文件是: + filePhotoName); image2 = Image.FromFile(filePhotoName); pictureBox1.Image = image2; catch MessageBox.Show(1.选择的文件必须是图片., 错误); filePhotoName = ; private void button10_Click(object sender, EventArgs e) pictureBox1.Image = null; filePhotoName = ; private void buttonGo_Click(object sender, EventArgs e) if (checkBox3.Checked) User =txtUser .Text; UserName =txtName .Text ; Address = txtAddress .Text ; PhoneNumber =txtPhoneNumber .Text ; Birthdy = txtBirthdy .Text; Introduce =txtIntroduce .Text ; Password =txtPassword .Text ; BankID =txtBankID .Text ; CardID =txtCardID .Text; Question =txtQuestion .Text ; Answer = txtAnswer .Text; if (User != & UserName != & Sex != & Address != & PhoneNumber != & Birthdy != & Introduce != & Password != & CardID != & Question != & Answer != ) if (User.Length = 11) Sqlconnect bs = new Sqlconnect(); DataSet BS = new DataSet(); BS = bs.GetDataFromDB(User); if (BS = null) if (filePhotoName != ) CopyWJJ f = new CopyWJJ(); f.CopyFile(filePhotoName, (MainFileName + UserImage+photoName); Encryption secrecy = new Encryption(); string SPassword = secrecy.UserMd5(Password); string SCardID = secrecy.UserMd5(CardID); string SAnswer = secrecy.UserMd5(Answer); Sqlconnect sql = new Sqlconnect(); bool set = sql.UpdateDB(AddS, User, ); if (set != false) set = sql.UpdateDB(AddP, User, ); set = sql.UpdateDB(AddM, User, ); set = sql.UpdateDB(US.Pa, SPassword, User); set = sql.UpdateDB(US.Ba, SCardID, User); set = sql.UpdateDB(US.Qu, Question, User); set = sql.UpdateDB(US.An, SAnswer, User); set = sql.UpdateDB(UP.Na, UserName, User); set = sql.UpdateDB(UP.Se, Sex, User); set = sql.UpdateDB(UP.Br, Birthdy, User); set = sql.UpdateDB(UP.Ar, Address, User); set = sql.UpdateDB(UP.Ta, Address, User); set = sql.UpdateDB(UP.Co, PhoneNumber, User); set = sql.UpdateDB(UP.In, Introduce, User); set = sql.UpdateDB(UM.MN, photoName, User); MessageBox.Show(注册成功!n您注册的账号为: + User + n密码是: + Password); Sqlconnect con = new Sqlconnect(); FLogin.UserDs = new DataSet(); FLogin.UserDs = con.GetDataFromDB(txtUser.Text.Trim(); if (FLogin.UserDs != null) LostAndFound.主界面.frmMain fr = new LostAndFound.主界面.frmMain(); fr.Show(); this.Close(); else MessageBox.Show(注册失败!n失败可能有以下原因:n1.该账号已经注册!n2.网络没有连接!n3.读取ini文件错误!); else MessageBox.Show(用户已注册!); elseMessageBox.Show(账号只能是11位数字!); elseMessageBox.Show(请把信息填写完整(银行账号和头像除外)!); else MessageBox.Show(请同意条款后,再注册!); private void txtUser_KeyPress(object sender, KeyPressEventArgs e) if (char.IsNumber(e.KeyChar) = false) e.Handled = true; if (Keys)(e.KeyChar) = Keys.Back | (Keys)(e.KeyChar) = Keys.Delete) return; 3. 主界面:窗口图片:代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using LostAndFound._2级窗口;using LostAndFound.类;namespace LostAndFound.主界面 public partial class frmMain : Form #region 全项目变量: public static FMain f =null; public static F2Set f2Set = null; public static F2Lost f2Lost = null; public static F2Found f2Found = null; public static F2Job f2Job = null; public static F2News f2News = null; public static F2Personal f2Personal = null; public static F2Shopping f2Shopping = null; public static F2Study f2Study = null; public static F2Chat1 f2Chat = null; public static F2Friend f2Friend=null ; public static F2Scaning f2Scaning = null; public static F2Share f2Share = null; public static FExit fExit = null; public static int MainLocation_x = 0; public static int MainLocation_y = 0; public static string SearchResult = ; public static Image MainPhoto = null; /Point formPoint; #endregion /本窗口变量: string MainFileName = FLogin.MainFileName; string User = FLogin.UserDs .Tables 0.Rows0.ItemArray 0.ToString (); string Passwork = FLogin.UserDs .Tables 0.Rows 0.ItemArray 1.ToString (); string PhotoName = ; public frmMain() InitializeComponent(); Rectangle rect = new Rectangle(); rect = Screen.GetWorkingArea(this ); MainLocation_x = (rect.Width / 2) - 682; MainLocation_y = (rect.Height / 2) - 369; this.BackColor = Color.Red ; this.TransparencyKey = this.BackColor; textBox1.BackColor =Color.White ; pictureBox2.Image = null; this.Location = new Point(MainLocation_x ,MainLocation_y); /托盘图标可见: notifyIcon1.Visible = true; /主页按钮背景更 Image SZ = Image.FromFile(MainFileName + Resources1捕获25.PNG); button37.Image = SZ; /加入帐号信息: / WriteINI wr = new WriteINI(); PhotoName = FLogin.UserDs.Tables2.Rows0.ItemArray2.ToString(); /wr.ReadPublicData(User ,PhotoName); if (PhotoName != ) try Image image = Image.FromFile(MainFileName + UserImage + PhotoName); pictureBox1.Image = image; MainPhoto = image; catch MessageBox.Show(头像加载失败!); PhotoName =; label1.Text = FLogin.UserDs.Tables1.Rows0.ItemArray1.ToString();/wr.ReadPublicData(User ,UserName); label2.Text = User; #region 对象化2级窗口: int x = this.Location.X; int y = this.Location.Y; MainLocation_x = x; MainLocation_y = y; f = new FMain(); /f.Show(); f2Lost = new F2Lost(); /f2Lost.Show(); f2Set = new F2Set(); / f2Set.Show(); f2Found = new F2Found(); /f2Found.Show(); f2Job = new F2Job(); /f2Job.Show(); f2News = new F2News(); /f2News.Show(); f2Personal = new F2Personal(); /f2Personal.Show(); f2Shopping = new F2Shopping(); /f2Shopping.Show(); f2Study = new F2Study(); /f2Study.Show(); f2Chat = new F2Chat1(); /f2Chat.Show(); #region 调整窗口 f2Set.Hide(); f2Lost.Hide(); f2Found.Hide(); f2Job.Hide(); f2News.Hide(); f2Personal.Hide(); f2Shopping.Hide(); f2Study.Hide(); f2Chat.Hide(); #endregion /f.Show(); f2Friend = new F2Friend(); /f2Friend.Show(); f2Friend.Hide(); f2Scaning =new F2Scaning (); /f2Scaning.Show(); f2Scaning.Hide(); f2Share = new F2Share(); /f2Share.Show(); f2Share.Hide(); fExit = new FExit(); /fExit.Show(); fExit.Hide(); f.Show(); #endregion #region 按钮背景更换 Image image = null; private void button20_MouseDown(object sender, MouseEventArgs e) image=Image.FromFile(MainFileName +otherClickImage.png); button20.Image = image; private void button20_MouseUp(object sender, MouseEventArgs e) button20.Image = null; private void button21_MouseDown(object sender, MouseEventArgs e) button21.Image = image; private void button21_MouseUp(object sender, MouseEventArgs e) button21.Image = null; private void button22_MouseDown(object sender, MouseEventArgs e) button22.Image = image; private void button22_MouseUp

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论