C#模拟QQ项目源代码

tech2024-01-04  75

一.C#模拟QQ登陆器

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; namespace DamonQQ { public partial class FrmLogin : Form { public FrmLogin() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //屏幕的高度 int ScreenH=1080; this.Location = new Point(this.Location.X, ScreenH - this.Height - 20); } private void button1_Click(object sender, EventArgs e) { //关闭本窗体,打开qq好友窗体 this.Hide(); FrmQQMain frmQQMain = new FrmQQMain(); frmQQMain.ShowDialog(); } private void pictureBox8_Click(object sender, EventArgs e) { //关闭本窗体,打开QQ设置窗体 this.Hide(); QQsetup QQsetup = new QQsetup(); QQsetup.ShowDialog(); }

2.1一些鼠标事件

private void pictureBox10_Click(object sender, EventArgs e) { this.Close(); } private void label1_MouseEnter(object sender, EventArgs e) { //鼠标进入时,标签变成黑色 lblFoundCode.ForeColor = Color.Black; } private void label1_MouseLeave(object sender, EventArgs e) { //鼠标离开时,标签变成灰色 lblFoundCode.ForeColor = Color.Gray; } private void checkBox2_MouseEnter(object sender, EventArgs e) { //鼠标进入时,标签变成黑色 chkRemember.ForeColor = Color.Black; } private void checkBox2_MouseLeave(object sender, EventArgs e) { //鼠标离开时,标签变成灰色 chkRemember.ForeColor = Color.Gray; } private void checkBox1_MouseEnter(object sender, EventArgs e) { //鼠标进入时,标签变成黑色 chkAutoLogin.ForeColor = Color.Black; } private void checkBox1_MouseLeave(object sender, EventArgs e) { //鼠标离开时,标签变成灰色 chkAutoLogin.ForeColor = Color.Gray; } private void label2_MouseEnter(object sender, EventArgs e) { //鼠标进入时,标签变成黑色 lblRegister.ForeColor = Color.Black; } private void label2_MouseLeave(object sender, EventArgs e) { //鼠标离开时,标签变成灰色 lblRegister.ForeColor = Color.Gray; } private void pictureBox10_MouseEnter(object sender, EventArgs e) { //鼠标进入时 图片背景变红 picClose.BackColor = Color.Red; }

2.2模拟QQ界面的一些特效

private void pictureBox10_MouseLeave(object sender, EventArgs e) { picClose.BackColor = Color.Transparent; } private void pictureBox9_MouseEnter(object sender, EventArgs e) { //颜色浅灰色半透明 picShrink.BackColor = Color.FromArgb(50, 200, 200, 200); } private void pictureBox9_MouseLeave(object sender, EventArgs e) { picShrink.BackColor = Color.Transparent; } private void pictureBox2_MouseEnter(object sender, EventArgs e) { //变成蓝色小企鹅 picLogin.BackgroundImage = Properties.Resources.iconqq;//此处应为蓝色 } private void pictureBox5_MouseEnter(object sender, EventArgs e) { picLoginTail.BackgroundImage = Properties.Resources.down_en; } private void pictureBox5_MouseLeave(object sender, EventArgs e) { picLoginTail.BackgroundImage = Properties.Resources.down_dis; }

2.3一些需判定的显示效果

bool isDrag;//是否拖动窗体 Point clickPoint; private void Form1_MouseDown(object sender, MouseEventArgs e) { isDrag = true; clickPoint = new Point(e.X, e.Y); } // Point movePoint; private void Form1_MouseMove(object sender, MouseEventArgs e) { if (isDrag ==true ) this.Location = new Point(this.Location.X + e.X - clickPoint.X, this.Location .Y +e.Y -clickPoint .Y ); clickPoint .X =e.X ; clickPoint .Y =e.Y ; } private void Form1_MouseUp(object sender, MouseEventArgs e) { isDrag = false; }

2.4头像背后弹出特效

bool isMoveout; bool isMoveback; private void pictureBox1_MouseEnter(object sender, EventArgs e) { //加号弹出 timer1.Enabled = true; isMoveout = true; } private void pictureBox1_MouseLeave(object sender, EventArgs e) { //加号弹回 isMoveout = false ; isMoveback = true; } private void timer1_Tick(object sender, EventArgs e) { if (isMoveout) { picMultiUser.Location = new Point(picMultiUser.Location.X + 10, picMultiUser.Location.Y); if (picMultiUser.Location.X >= 277) { timer1.Enabled = false; return; } } else { picMultiUser.Location = new Point(picMultiUser.Location.X - 10, picMultiUser.Location.Y); if (picMultiUser.Location.X <= 178) { timer1.Enabled = false; return; } } } private void picSet_MouseEnter(object sender, EventArgs e) { picSet.BackColor = Color.FromArgb(50, 200, 200, 200); } private void picSet_MouseLeave(object sender, EventArgs e) { picSet.BackColor = Color.Transparent; } private void picQuickMark_MouseEnter(object sender, EventArgs e) { picQuickMark.BackgroundImage = Properties.Resources.tdcode1; } private void picQuickMark_Click(object sender, EventArgs e) { //关闭本窗体,打开二维码窗体 this.Hide(); QuickMark QuickMark = new QuickMark(); QuickMark.ShowDialog(); } private void picQuickMark_MouseLeave(object sender, EventArgs e) { picQuickMark.BackgroundImage = Properties.Resources.tdcode; } private void picKeyboard_MouseEnter(object sender, EventArgs e) { picKeyboard.BackgroundImage = Properties.Resources.keyboard1; } private void picKeyboard_MouseLeave(object sender, EventArgs e) { picKeyboard.BackgroundImage = Properties.Resources.keyboard; } } }

2.5弹出距离计算

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; namespace DamonResign { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button2_MouseEnter(object sender, EventArgs e) { Random r = new Random(); button2.Location = new Point(r.Next() % (this.Width - button2.Width), r.Next() % (this.ClientSize.Height - button2.Height)); } private void button1_Click(object sender, EventArgs e) { this.Hide(); Form2 form2 = new Form2 (); form2.ShowDialog(); } } }
最新回复(0)