C#实现简单气泡屏保(二)
上期续集–强化版
具体代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;//要应用GraphicsPath这个类,命名空间中必须有Drawing.Drawing2D,因为原命名空间中没有,所以需要自行添加此命名空间.namespace Test_PaoPao
{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){this.FormBorderStyle = FormBorderStyle.None;//去边框this.Size = new Size(200,200);this.Location = new Point(0,0);this.Opacity = 0.7;//透明度0.3Random s = new Random();//随机生成器//气泡背景颜色随机this.BackColor = Color.FromArgb(s.Next(0, 255), s.Next(0, 255), s.Next(0, 255));label1.Text = "深夜食堂";label1.Font = new Font("黑体",20f);//设置字体//实例化GraphicsPath类,拿到Bx对象GraphicsPath Bx = new GraphicsPath();//使用AddEllipse方法使窗体变为圆形Bx.AddEllipse(0,0,this.Width,this.Height);//设置与控件关联的窗体区域this.Region = new Region(Bx);timer1.Interval = 10;timer1.Start();}//设置变量使小球运动int x = 5;//水平int y = 5;//垂直private void timer1_Tick(object sender, EventArgs e){//分析:碰到顶部和底部x不变,y取反;碰到左右两边y不变,x取反//分两种情况:1、先碰到底部(left不变化,top正负不断变化) 2、先碰到右边(left正负不断变化,top不变)this.Left += x;this.Top += y;if (this.Top+this.Height>=Screen.PrimaryScreen.WorkingArea.Height||this.Top<=0){y = -y;//Form1 form1 = new Form1();//实例化Form1//form1.Show();//应用Form1全部属性//form1.Location = new Point(300,100);//form1.label1.Text = "久睡成瘾";}if (this.Left+this.Width>=Screen.PrimaryScreen.WorkingArea.Width||this.Left<=0){x = -x;//Form1 form2 = new Form1();//form2.Show();//form2.Location = new Point(900,200);//form2.label1.Text = "疯狂GANK";}}}
}
看完的朋友记得点赞嗷,下期更精彩!!!
C#实现简单气泡屏保(二)相关推荐
- c#第二课,气泡屏保
回顾 属性赋值(4种) (1)直接赋值语法:15种数据类型 整数(8种) int uint short ushort long ulong- 浮点型(3种)double float decimal 布 ...
- 【JavaGUI demo】swing仿Windows气泡屏保动画(含源码)
概述 java实现简单泡泡屏保动画及点击变实心泡泡,空格暂停动画 实现思路 采用MVC(Model-View-Controller(模型-视图-控制器))设计思路.将数据层与视图层与控制层分开. 在本 ...
- C#实现气泡屏保(四个timer实现)
四个timer实现气泡屏保 using System; using System.Collections.Generic; using System.ComponentModel; using Sys ...
- php气泡效果,js 模拟气泡屏保效果代码_其他特效
核心代码: var T$ = function(id) { return document.getElementById(id); } var $extend = function(des, src) ...
- C#实现气泡屏保(1个timer实现)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- C#实现气泡屏保效果(用4个timer)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- 用JavaScript写一个类似于windows的气泡屏保效果
最近在学习JavaScript,然后在书上看到了一个简单的碰壁反弹效果,效果你们可以看一下,js代码如下: window.onload = function(){var main = document ...
- C#实现气泡屏保效果(用1个timer)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- [ActionScript 3.0] 模拟win7彩色气泡屏保效果
主文件: package {import com.views.BubbleView;import com.views.ColorfulBubble;import flash.display.Sprit ...
- 基于Win32的不规则透明窗口(模拟win7气泡屏保)——透明气泡的实现
通过win32 API模拟透明气泡. 先看效果: 源代码下载: https://download.csdn.net/download/qq_35553864/10656109
最新文章
- 从Webshell到肉鸡
- windows 下 sublime Text3 做 Python 编辑器
- 钢材种类有哪些?怎么分类
- java 匿名类 实现接口_细谈 Java 匿名内部类 【分别 使用 接口 和 抽象类实现】...
- 这个避孕套让生活更和谐……
- client中周期性边界_「微评」增加艺术品在投资组合中的比例 推进国家艺术软实力...
- 4.3.3版本之引擎bug
- 前端学习(2254)team怎么接受到pr
- mysql一张表1亿天数据_1亿条数据在PHP中实现Mysql数据库分表100张
- 使用Maven构建Struts2项目
- 解决非javascript浏览器的问题
- go语言 html 5 gui,仅需简单 5 步,给你的 Golang 程序添加 GUI (使用 Electron )
- SVN客户端安装详细教程
- android浏览器病毒,2018安卓手机杀毒软件排行榜
- 服饰柔性3D渲染调研及实践
- DSP程序死机(跑飞)的一些情况-硬件原因
- 智慧停车系统源码-后台全开源的商业级智慧停车系统源码-YunParking
- uva 10246(最短路变形)
- 网络型PLC可编程控制器实验装置(立式、挂箱积木式)
- Flarum 插件扩展 特定事件订阅插件Subscribed