| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 17501 人关注过本帖
标题:[原创]C#写的'假'QQ程序!!(附:代码)
只看楼主 加入收藏
水中游
Rank: 3Rank: 3
等 级:新手上路
威 望:9
帖 子:149
专家分:0
注 册:2006-3-20
收藏
得分:0 

本来想早一点把代码贴出来,可是有些人好像认为没用^^^^^^^^^^^
我希望楼上的朋友能做个更好的分享一下……
我是说明了,主要是"QQ窗体停靠"的效果呀

form1代码:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;

namespace QQ
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.ComponentModel.IContainer components;

public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();

//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}

/// <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()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// notifyIcon1
//
this.notifyIcon1.ContextMenu = this.contextMenu1;
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Text = "QQ-水中游版";
this.notifyIcon1.Visible = true;
this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem2});
this.contextMenu1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.Text = "关于";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.Text = "退出";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox1.Location = new System.Drawing.Point(175, 5);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(16, 16);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.MouseEnter += new System.EventHandler(this.Form1_MouseEnter);
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
this.pictureBox1.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
//
// pictureBox2
//
this.pictureBox2.BackColor = System.Drawing.Color.Transparent;
this.pictureBox2.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox2.Location = new System.Drawing.Point(141, 5);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(16, 16);
this.pictureBox2.TabIndex = 1;
this.pictureBox2.TabStop = false;
this.pictureBox2.MouseEnter += new System.EventHandler(this.Form1_MouseEnter);
this.pictureBox2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox2_MouseUp);
this.pictureBox2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox2_MouseDown);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(196, 577);
this.ContextMenu = this.contextMenu1;
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.pictureBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Location = new System.Drawing.Point(600, 0);
this.Name = "Form1";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "QQ";
this.TopMost = true;
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
this.MouseEnter += new System.EventHandler(this.Form1_MouseEnter);
this.MouseLeave += new System.EventHandler(this.Form1_MouseLeave);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form2());
}
int dx;
int dy;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.ContextMenu contextMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
int shubiao;
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button ==MouseButtons.Left)
{
dx=e.X ;dy=e.Y;
}

}

private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button ==MouseButtons.Left&&this.Size .Height ==577)
{
this.Left =this.Left +(e.X -dx);

this.Top =this.Top +(e.Y -dy);

Application.DoEvents ();/*节省运行资源*/
}


}

private void Form1_MouseEnter(object sender, System.EventArgs e)
{
this.ClientSize = new System.Drawing.Size(196,577);
this.shubiao =1;

}

private void Form1_MouseLeave(object sender, System.EventArgs e)
{
this.shubiao =0;
if(this.Location .Y==0&&this.shubiao ==0 )
this.ClientSize = new System.Drawing.Size(196,2);
}

private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{if(this.Top <0) this.Top =0;

}
private void menuItem1_Click(object sender, System.EventArgs e)
{
MessageBox.Show(" 滨州职业学院-软件工程学院\n计算机信息科学系05级软件-水中游制作\n \t\txcligood@gmail.com","QQ界面程序");
}

private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
{
if(this.WindowState== System.Windows.Forms.FormWindowState.Normal )
{this.WindowState = System.Windows.Forms.FormWindowState.Minimized;this.Opacity =0;}
else {this.WindowState = System.Windows.Forms.FormWindowState.Normal ;
this.Opacity =1;}

}

private void pictureBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.notifyIcon1.Visible = false;
Application.Exit();
}

private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
}

private void pictureBox2_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
}

private void pictureBox2_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.WindowState = FormWindowState.Minimized;
this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.Opacity =0;
}

private void pictureBox1_MouseLeave(object sender, System.EventArgs e)
{
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
}

private void menuItem2_Click(object sender, System.EventArgs e)
{
this.notifyIcon1.Visible = false;
Application.Exit();
}


}
}





锻炼中学习……学习中成长……
2006-04-22 08:15
水中游
Rank: 3Rank: 3
等 级:新手上路
威 望:9
帖 子:149
专家分:0
注 册:2006-3-20
收藏
得分:0 

form2代码:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace QQ
{
/// <summary>
/// Form2 的摘要说明。
/// </summary>
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox4;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;

public Form2()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();

//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}

/// <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.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form2));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox1.Location = new System.Drawing.Point(304, 5);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(21, 21);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
this.pictureBox1.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
//
// pictureBox2
//
this.pictureBox2.BackColor = System.Drawing.Color.Transparent;
this.pictureBox2.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox2.Location = new System.Drawing.Point(258, 5);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(21, 21);
this.pictureBox2.TabIndex = 1;
this.pictureBox2.TabStop = false;
this.pictureBox2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox2_MouseUp);
this.pictureBox2.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
this.pictureBox2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox2_MouseDown);
//
// pictureBox3
//
this.pictureBox3.BackColor = System.Drawing.Color.Transparent;
this.pictureBox3.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox3.Location = new System.Drawing.Point(156, 210);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(76, 22);
this.pictureBox3.TabIndex = 2;
this.pictureBox3.TabStop = false;
this.pictureBox3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox3_MouseUp);
this.pictureBox3.MouseLeave += new System.EventHandler(this.pictureBox3_MouseLeave);
this.pictureBox3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox3_MouseDown);
//
// pictureBox4
//
this.pictureBox4.BackColor = System.Drawing.Color.Transparent;
this.pictureBox4.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox4.Location = new System.Drawing.Point(240, 210);
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(76, 22);
this.pictureBox4.TabIndex = 3;
this.pictureBox4.TabStop = false;
this.pictureBox4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
this.pictureBox4.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
this.pictureBox4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox4_MouseDown);
//
// Form2
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.Control;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(330, 245);
this.Controls.Add(this.pictureBox4);
this.Controls.Add(this.pictureBox3);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.pictureBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Form2";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "QQ用户登录";
this.TopMost = true;
this.Click += new System.EventHandler(this.Form2_Click);
this.ResumeLayout(false);

}
#endregion
private void Form2_Click(object sender, System.EventArgs e)
{
MessageBox.Show("说明:\n 体验用C#制作类似QQ窗体停靠的效果!\n请直接按“登录”键进行登录!\n\n 滨州职业学院-软件工程学院\n计算机信息科学系05级软件-水中游制作\n \t\txcligood@gmail.com","QQ界面程序");
}

private void pictureBox3_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.pictureBox3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
}

private void pictureBox3_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
Form1 str =new Form1();//建立一个实例对象名字为str,Form2为新窗体的名字。
str.Show();
this.Hide();
}

private void pictureBox3_MouseLeave(object sender, System.EventArgs e)
{
this.pictureBox3.BorderStyle = System.Windows.Forms.BorderStyle.None ;
}

private void pictureBox2_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
}

private void pictureBox2_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.None ;

}

private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
}

private void pictureBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
Application.Exit();
}

private void pictureBox1_MouseLeave(object sender, System.EventArgs e)
{
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.None ;
this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.None ;
this.pictureBox4.BorderStyle = System.Windows.Forms.BorderStyle.None ;
}

private void pictureBox4_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.pictureBox4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
}
}
}


锻炼中学习……学习中成长……
2006-04-22 08:16
龙游九天
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2006-4-21
收藏
得分:0 
    他也不错拉,能作成这样的学生还没几个。

2006-04-22 08:26
水中游
Rank: 3Rank: 3
等 级:新手上路
威 望:9
帖 子:149
专家分:0
注 册:2006-3-20
收藏
得分:0 
让大家失望了.
可能没做到大家希望的那样(真正联网的QQ),望谅解!
我还是个初学者,还希望得到大家的帮助!!

锻炼中学习……学习中成长……
2006-04-22 08:42
zhouzhuo_11
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-4-22
收藏
得分:0 
好~~ 只不过有点   

每时每刻的失去,创造着每分每秒的美丽。每时每刻的呼唤,消磨着每分每秒的艰难。一路走…………,一路汗!
2006-04-22 11:05
luyisalama
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-4-15
收藏
得分:0 
2006-04-23 21:06
jack033
Rank: 1
等 级:新手上路
帖 子:64
专家分:0
注 册:2006-1-2
收藏
得分:0 
这个东西我们老师也让我们做过,
效果和qq界面一样,不过代码什么的,好象和楼主的不同
主要是控件不同,也许我们做的比较简单,毕竟我们是刚开始学的。

我还是新手,在以后希望能得到大家的帮助~~~~
2006-04-24 08:10
乱弹琴
Rank: 1
等 级:新手上路
威 望:1
帖 子:1665
专家分:0
注 册:2006-3-7
收藏
得分:0 
支持原创

男人的謊言可以騙女人的壹夜! 女人的謊言可以騙男人的壹生!
2006-04-26 11:46
梦幻情缘
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:769
专家分:20
注 册:2005-4-4
收藏
得分:0 
给予支持!
2006-04-28 20:57
花自飘零水自流
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-4-28
收藏
得分:0 
[QUOTE]

我也看了下 真的很不错~!
那QQ窗体怎样创建的啊~!运用到了哪些工具控件?
能详细的告诉我怎么建哪个窗体吗?

[/QUOTE]人不上进,不就象水一样只有下流了~!

切记人生四千万:千万不要去触碰脆弱的爱情,千万不要虚度年华,千万要爱护自己, 千万要懂得珍惜 !
2006-04-28 22:16
快速回复:[原创]C#写的'假'QQ程序!!(附:代码)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025599 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved