QQ项目之七窗体悬浮
【摘要】
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms; namespace ...
-
using System;
-
using System.Collections.Generic;
-
using System.ComponentModel;
-
using System.Data;
-
using System.Drawing;
-
using System.Text;
-
using System.Windows.Forms;
-
-
namespace MYQQ
-
{
-
public partial class FrmUserInformation : Form
-
{
-
public Point point;
-
public FrmUserInformation()
-
{
-
InitializeComponent();
-
}
-
-
-
//悬浮至好友Q名时
-
private void lblChatName_MouseEnter(object sender, EventArgs e)
-
{
-
lblName.Font = new Font("微软雅黑", 16F, FontStyle.Underline);
-
}
-
-
//离开好友Q名时
-
private void lblChatName_MouseLeave(object sender, EventArgs e)
-
{
-
lblName.Font = new Font("宋体", 9F);
-
}
-
-
//窗口加载时
-
private void FrmInformation_Load(object sender, EventArgs e)
-
{
-
//初始化窗口出现位置
-
this.Location = point;
-
lblName.Text = UserHelper.myNickName;
-
}
-
-
//窗体重绘时
-
private void FrmUserInformation_Paint(object sender, PaintEventArgs e)
-
{
-
Graphics g = e.Graphics;
-
SolidBrush sb = new SolidBrush(Color.FromArgb(100, 255, 255, 255));
-
g.FillRectangle(sb, new Rectangle(new Point(1, Height - 103), new Size(Width - 2, 80)));
-
}
-
-
#region 渐变效果
-
-
public bool isOpend = false;
-
/// <summary>
-
/// 隐藏
-
/// </summary>
-
public new void Hide()
-
{
-
timHide.Enabled = true;
-
-
}
-
public new void Show() {
-
this.Location = point;
-
timShow.Enabled = true;
-
}
-
#endregion
-
-
/*
-
代码思路:隐藏的时候,让窗体渐渐的隐藏,开始的时候,窗体渐渐显示;
-
-
*/
-
#region 总计时器
-
-
//计时器
-
private void timShow_Tick(object sender, EventArgs e)
-
{
-
base.Show();
-
if (this.Opacity <1)
-
{
-
this.Opacity = this.Opacity + 0.1;
-
}
-
if (this.Opacity == 1.0)
-
{
-
timShow.Enabled = false;
-
}
-
}
-
-
#endregion
-
-
private void timHide_Tick(object sender, EventArgs e)
-
{
-
if (this.Opacity > 0)
-
{
-
this.Opacity = this.Opacity - 0.1;
-
}
-
if (this.Opacity == 0.0)
-
{
-
timHide.Enabled = false;
-
base.Hide();
-
}
-
}
-
-
}
-
}
视频课堂https://edu.csdn.net/course/play/7621
文章来源: aaaedu.blog.csdn.net,作者:tea_year,版权归原作者所有,如需转载,请联系作者。
原文链接:aaaedu.blog.csdn.net/article/details/50486880
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)