首先看一下运行之后的效果图

接下来就是代码了

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 System.Drawing.Drawing2D;namespace FromPaoPao
{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){GraphicsPath g = new GraphicsPath();g.AddEllipse(0,0,this.Width,this.Height);this.Region = new Region(g);this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);timer1.Start();}private void timer1_Tick(object sender, EventArgs e){if (this.Top > 0 && this.Left > 0 && this.Left >= Screen.PrimaryScreen.WorkingArea.Width - this.Width){this.Top -= 3;}else if (this.Left >0 && this.Top<=0){this.Left -= 3;}else if (this.Bottom <= Screen.PrimaryScreen.WorkingArea.Height){this.Top += 3;}else if (this.Right <= Screen.PrimaryScreen.WorkingArea.Width ){this.Left+=3;}}private void timer2_Tick(object sender, EventArgs e){}private void button1_Click(object sender, EventArgs e){}}
}

原理就是通过判断屏幕的距离来改变泡泡的方向!布局比较简单,就是在窗口上面放置一个震动的按钮

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 System.Threading;
using System.Drawing.Drawing2D;namespace FromPaoPao
{public partial class Form2 : Form{public Form2(){InitializeComponent();}private void Form2_Load(object sender, EventArgs e){/* GraphicsPath g = new GraphicsPath();g.AddEllipse(0, 0, this.Width, this.Height);this.Region = new Region(g);*/}private void button1_Click(object sender, EventArgs e){int x = this.Location.X;int y = this.Location.Y;for(int i=0;i<=10;i++){this.Location = new Point(x-100,y);this.BackColor = Color.AntiqueWhite;Thread.Sleep(60);this.Location = new Point(x-100,y+100);this.BackColor = Color.Aqua;Thread.Sleep(60);this.Location = new Point(x, y + 100);this.BackColor = Color.Azure;Thread.Sleep(60);this.Location = new Point(x + 100, y + 100);this.BackColor = Color.BlanchedAlmond;Thread.Sleep(60);this.Location = new Point(x + 100, y);this.BackColor = Color.Crimson;Thread.Sleep(60);this.Location = new Point(x + 100, y - 100);this.BackColor = Color.DarkCyan;Thread.Sleep(60);this.Location = new Point(x, y - 100);this.BackColor = Color.DarkTurquoise;Thread.Sleep(60);this.Location = new Point(x - 100, y - 100);this.BackColor = Color.Red;Thread.Sleep(60);}MessageBox.Show("你知道震动了多少圈吗?猜出有奖","看一看");this.Location = new Point(x, y);}}
}

C# 窗口实现Win7简单屏幕泡泡保护程序 和实现聊天窗口震动相关推荐

  1. win7桌面的计算机在哪里设置密码,win7如何添加屏幕保护密码|win7设置屏幕保护密码的方法...

    ‍‍ 有时我们会为了防止被人看到计算机上的信息,会设置开机登录密码来保护我们的信息安全.但是有时我们只是离开计算机一小会,那我们可以设置屏幕保护密码来保护计算机,那么win7如何添加屏幕保护密码呢?下 ...

  2. win7 锁定计算机 失效,win7系统屏幕保护功能失效无法进入屏幕保护状态怎么办...

    win7系统自带屏幕保护功能,屏幕保护程序既能节省电量又能保护我们的显示器.如果打开电脑后临时有事,离开电脑后就会自动进入屏幕保护程序,将刚才工作的状态隐藏起来,非常好用.但是有用户反映说win7电脑 ...

  3. w7计算机屏幕保护设置在哪,Win7屏保怎么设置?Win7屏幕保护程序如何打开?

    Win7屏保怎么设置?Win7系统中的屏幕保护程序一般是从桌面右键进入的,但很多用户使用的是Win7家庭版系统,右键没有个性化设置,这种情况只能从控制面板中进入,至于如何设置屏幕保护,相信用户进入之后 ...

  4. 怎样保护计算机桌面不被更改,Win7屏幕保护程序不能修改怎么办 win7无法设置电脑屏幕保护程序如何解决...

    大家都知道当我们的电脑待机之后就会出现一个屏幕保护程序界面,可以更好的节省能耗,有些win7系统用户觉得默认的屏幕保护程序效果图标不好看,所以就想要将其修改,然而却发现屏幕保护不能修改,要怎么办呢,针 ...

  5. 打开计算机窗口抖动是什么原因,Win7电脑屏幕一直抖动的解决方法

    Win7系统的电脑屏幕一直抖动,声音.程序运行则一切正常,这有可能是屏幕硬件的问题,也有可能是电脑设置不当引起的,还有可能是驱动不兼容造成的.下面就来介绍一下Win7电脑屏幕抖动的原因和解决方法. 原 ...

  6. 个性屏幕保护程序_Mac高清鸟瞰屏幕保护程序,酷毙了

    最新的Aerial for Mac配备了一个漂亮的屏幕保护程序,由在旧金山,纽约,伦敦,中国和许多其他地方录制的一系列航拍电影组成.如果您想在Mac上使用这些剪辑,现在有一种简单的方法可以实现. Ae ...

  7. 计算机无法屏幕亮度,win7电脑屏幕亮度无法调节怎么办?调节屏幕亮度的方法...

    众所周知,调节一个舒适屏幕亮度是非常重要的,可以保护眼睛.最近有用户发现屏幕亮度无法调节,使用键盘上的组合键调节屏幕亮度后,发现屏幕突然变得较暗.想再将屏幕调亮发现试了好几个方法都没有效果,该怎么解决 ...

  8. 如何停止屏幕保护程序?

    如何停止屏幕保护程序? <script type="text/javascript"> </script> <script src="htt ...

  9. 使用Win32 SDK开发屏幕保护程序

    暮鼓集    行走集 1.引言 屏幕保护程序(Screen Saver)的历史几乎与视窗操作系统的历史一样悠久,设计它的目的是为了保护CRT显示器使其的使用寿命更长.但随着技术的进步,新型的CRT显示 ...

最新文章

  1. 做acm 需要学的算法
  2. 途游斗地主加密协议分析及破解
  3. 【自适应(盲)均衡6】信号过多径衰落信道的矩阵乘法表示之Toeplitz矩阵和Toeplitz块矩阵的生成(分数间隔FSE)
  4. StackExchange.Redis 官方文档(六) PipelinesMultiplexers
  5. 将一个长度最多为30位数字的十进制非负整数转换为二进制数(Java)
  6. 数列极差(信息学奥赛一本通-T1427)
  7. iOS开发之CALayer
  8. php sql 条件拼组_sql where查询拼接技巧
  9. 微信支付小程序开发php,关于微信小程序进行微信支付的步骤
  10. MapReduce实现kmeans算法
  11. (自我归纳)费曼学习法
  12. 51单片机学习笔记7 -- 超声波测距
  13. radio按扭设置只读_关于html:为什么单选按钮不能为“只读”?
  14. Linux中rar解压软件
  15. java中映射关系Map
  16. Java并发编程 - 共享模型之管程
  17. python怎么应用在机械领域的国家砝码_2020尔雅通识课Python璇█搴旂敤答案获取...
  18. 华南理工大学化学考研
  19. 攻击法国海军病毒Conficker在中国网络同步蔓延
  20. java flowable_rxJava reactivex.Flowable使用

热门文章

  1. 读书笔记-Office 365开发入门指南
  2. 知乎如何通过关键字搜索文章
  3. OC8051内部逻辑分析(1)
  4. kicad原件封装自动生成
  5. 全球与中国PH和ORP通用分析仪市场深度研究分析报告
  6. matlab 色块图,matlab绘制矩阵色块图
  7. 4417. 神奇的字符串
  8. Android 微信原生登录,支付,以及一些奇奇怪怪的问题。(wxApi.isWXAppInstalled 一直返回false)
  9. 视频教程-wordpress建站教程之环境部署详解课程-PHP
  10. 盟百照相馆影楼摄影工作室选片系统