为了不让大家再误会,我在这里声明,我做的是在登录后的提示,只要大家用过QQ,Q会员开通过就知道 的,
先看一下效果吧
说一下实现 吧,
第一步是先把QQ会员 便当 的框给截图下来,然后放到Ps里P一下,需要做到这样就行了,看图片
caozuo有两个值一个是
load
表示要向不透明方向增加量,也就是说会慢慢看清楚,还有一个close 表示要向透明方向增加量,这样会慢慢的看不到窗体,我是用一个Timer来处理的
这样只要caozuo的值发生变化的时候 就会向某个方向开始增加渐变显示 的量
当鼠标进入的时候我是这样处理的
这样的话就会在原来的基础上加量,也就是说如果快不显示了,当
鼠标
移动进入窗体时就双会慢慢的显示,当移开的时候我是这样处理的
这样就双会启动定时关闭窗体,我的定时是6秒大家可以随便改的效果就是这样实现的
因为我的窗体 是没有标题栏的这样就不能拖动了, 很不方便,拖动窗体的方法有很多,我是这样实现 的,
关于这个内容 可以参考 我的文章
拖动无标题窗体的方法
http://www.cckan.net/forum.php?mod=viewthread&tid=68
先看一下效果吧
![](https://i-blog.csdnimg.cn/blog_migrate/5ac7589889a10c1f520126b255fe9d3b.jpeg)
说一下实现 吧,
第一步是先把QQ会员 便当 的框给截图下来,然后放到Ps里P一下,需要做到这样就行了,看图片
![](https://i-blog.csdnimg.cn/blog_migrate/e6ccfbe5ff8f8bcca3dfe30fc6103157.png)
第二步,可以在上面加一 些Lable就行了,关闭按钮是两个图片,切换的方法是这样的
private
void
pictureBox1_MouseLeave(
object
sender, EventArgs e)
{
pictureBox1.BackgroundImage = ClientSystem.Properties.Resources.lgintop;
}
//图片进入事件
private
void
pictureBox1_MouseEnter(
object
sender, EventArgs e)
{
pictureBox1.BackgroundImage = ClientSystem.Properties.Resources.lgintop1;
}
第三步,IP的取法我就不说了有很多,还有上面的4.0的测试这些都 是加上的新闻,只要启动浏览器就行了,
启动的方法是
//系统官网
private
void
label7_Click(
object
sender, EventArgs e)
{
Process.Start(
"http//www.cckan.net/"
);
}[/code]
第四步,说一下渐变显示 的效果的处理方法
[mw_shl_code=csharp,
true
]代码
//界面加载
private
void
Messages_Load(
object
sender, EventArgs e)
{
try
{
//让窗体加载时显示到右下角
int
x = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - 255;
int
y = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - 161;
this
.SetDesktopLocation(x, y);
//加载显示信息
ShowComptureInfo();
//渐变显示这里表示加载
caozuo =
"load"
;
this
.Opacity = 0;
}
catch
(Exception)
{
}
}
//定时处理渐变的效果
private
void
timer2_Tick(
object
sender, EventArgs e)
{
if
(caozuo ==
"load"
)
{
this
.Opacity += 0.09;
}
else
if
(caozuo ==
"close"
)
{
this
.Opacity =
this
.Opacity - 0.09;
if
(
this
.Opacity == 0)
this
.Close();
}
}
当鼠标进入的时候我是这样处理的
//进入窗体事件
private
void
Messages_MouseEnter(
object
sender, EventArgs e)
{
//停止定时关闭
timer1.Enabled =
false
;
//开始渐变加载
caozuo =
"load"
;
}
//窗体离开事件
private
void
Messages_MouseLeave(
object
sender, EventArgs e)
{
timer1.Enabled =
true
;
}
//定时关闭窗体
private
void
timer1_Tick(
object
sender, EventArgs e)
{
timer2.Enabled =
true
;
caozuo =
"close"
;
//关闭窗体
}
因为我的窗体 是没有标题栏的这样就不能拖动了, 很不方便,拖动窗体的方法有很多,我是这样实现 的,
private
bool
isMouseDown =
false
;
private
Point FormLocation;
//form的location
private
Point mouseOffset;
//鼠标的按下位置
//鼠标安下
private
void
Messages_MouseDown(
object
sender, MouseEventArgs e)
{
try
{
if
(e.Button == MouseButtons.Left)
{
isMouseDown =
true
;
FormLocation =
this
.Location;
mouseOffset = Control.MousePosition;
}
}
catch
(Exception)
{
}
}
//鼠标移动
private
void
Messages_MouseMove(
object
sender, MouseEventArgs e)
{
try
{
int
_x = 0;
int
_y = 0;
if
(isMouseDown)
{
Point pt = Control.MousePosition;
_x = mouseOffset.X - pt.X;
_y = mouseOffset.Y - pt.Y;
this
.Location =
new
Point(FormLocation.X - _x, FormLocation.Y - _y);
}
}
catch
(Exception)
{
}
}
//鼠标松开
private
void
Messages_MouseUp(
object
sender, MouseEventArgs e)
{
try
{
isMouseDown =
false
;
}
catch
(Exception)
{
}
}
拖动无标题窗体的方法
http://www.cckan.net/forum.php?mod=viewthread&tid=68
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
ClientSystem.ClientSystemServices;
using
BaseFunction;
using
System.Diagnostics;
namespace
ClientSystem
{
/// <summary>
/// 提示窗体 苏飞
/// </summary>
public
partial
class
Messages : Form
{
public
Messages()
{
InitializeComponent();
}
//营业厅完整信息
public
OfficeInfo OfficeInfo {
get
;
set
; }
#region //私有变量和方法
private
ClientSystemServices.Service1SoapClient user =
new
Service1SoapClient();
//显示登录用户的计算机信息
public
void
ShowComptureInfo()
{
//CUP
//label9.Text = ComputerInfo.GetCpuID();
//硬盘
//label26.Text = ComputerInfo.GetDiskID();
//IP
lblIP.Text = ComputerInfo.GetIPAddress();
//上次登录IP
lbloldIP.Text = ComputerInfo.GetIPAddress();
//用户名
lblUser.Text = OfficeInfo.ofLogin +
" 商户欢迎您"
;
//计算机名称
//label21.Text = ComputerInfo.GetComputerName();
//操作系统
//label23.Text = ComputerInfo.GetSystemType();
//当前用户
//label25.Text = ComputerInfo.GetUserName();
}
#endregion
//界面加载
private
void
Messages_Load(
object
sender, EventArgs e)
{
try
{
//让窗体加载时显示到右下角
int
x = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - 255;
int
y = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - 161;
this
.SetDesktopLocation(x, y);
//加载显示信息
ShowComptureInfo();
//渐变显示这里表示加载
caozuo =
"load"
;
this
.Opacity = 0;
}
catch
(Exception)
{
}
}
//关闭按钮
private
void
pictureBox1_Click(
object
sender, EventArgs e)
{
this
.Close();
}
//图片离开事件
private
void
pictureBox1_MouseLeave(
object
sender, EventArgs e)
{
pictureBox1.BackgroundImage = ClientSystem.Properties.Resources.lgintop;
}
//图片进入事件
private
void
pictureBox1_MouseEnter(
object
sender, EventArgs e)
{
pictureBox1.BackgroundImage = ClientSystem.Properties.Resources.lgintop1;
}
//修改密码
private
void
label6_Click(
object
sender, EventArgs e)
{
ChangePwd frm =
new
ChangePwd();
frm.OfficeInfo =
this
.OfficeInfo;
frm.Show();
}
//系统官网
private
void
label7_Click(
object
sender, EventArgs e)
{
Process.Start(
"http://www.smxzc.com/"
);
}
#region//拖动无标题窗体
private
bool
isMouseDown =
false
;
private
Point FormLocation;
//form的location
private
Point mouseOffset;
//鼠标的按下位置
//鼠标安下
private
void
Messages_MouseDown(
object
sender, MouseEventArgs e)
{
try
{
if
(e.Button == MouseButtons.Left)
{
isMouseDown =
true
;
FormLocation =
this
.Location;
mouseOffset = Control.MousePosition;
}
}
catch
(Exception)
{
}
}
//鼠标移动
private
void
Messages_MouseMove(
object
sender, MouseEventArgs e)
{
try
{
int
_x = 0;
int
_y = 0;
if
(isMouseDown)
{
Point pt = Control.MousePosition;
_x = mouseOffset.X - pt.X;
_y = mouseOffset.Y - pt.Y;
this
.Location =
new
Point(FormLocation.X - _x, FormLocation.Y - _y);
}
}
catch
(Exception)
{
}
}
//鼠标松开
private
void
Messages_MouseUp(
object
sender, MouseEventArgs e)
{
try
{
isMouseDown =
false
;
}
catch
(Exception)
{
}
}
#endregion
//定时关闭窗体
private
void
timer1_Tick(
object
sender, EventArgs e)
{
timer2.Enabled =
true
;
caozuo =
"close"
;
//关闭窗体
}
//进入窗体事件
private
void
Messages_MouseEnter(
object
sender, EventArgs e)
{
//停止定时关闭
timer1.Enabled =
false
;
//开始渐变加载
caozuo =
"load"
;
}
//窗体离开事件
private
void
Messages_MouseLeave(
object
sender, EventArgs e)
{
timer1.Enabled =
true
;
}
string
caozuo =
""
;
//定时处理渐变的效果
private
void
timer2_Tick(
object
sender, EventArgs e)
{
if
(caozuo ==
"load"
)
{
this
.Opacity += 0.09;
}
else
if
(caozuo ==
"close"
)
{
this
.Opacity =
this
.Opacity - 0.09;
if
(
this
.Opacity == 0)
this
.Close();
}
}
}
}