C#实现气泡屏保效果(用1个timer)
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;namespace _03气泡_续续集
{public partial class Form1 : Form{public Form1(){InitializeComponent();}Label lb = new Label();Timer time = new Timer();private void Form1_Load(object sender, EventArgs e){this.WindowState = FormWindowState.Maximized;this.FormBorderStyle = FormBorderStyle.None;lb.Text = "一屉热乎乎的小笼包";lb.Font = new Font("楷体",30);lb.AutoSize = true;this.Controls.Add(lb);time.Interval = 1;time.Start();time.Tick += Time_Tick;}int x = 5;int y = 5;private void Time_Tick(object sender, EventArgs e){lb.Left = lb.Left + x;lb.Top = lb.Top + y;if (x>0 && y>0){if (lb.Top+lb.Height>=Screen.PrimaryScreen.WorkingArea.Height){x = 5;y = -5;}if (lb.Left+lb.Width>=Screen.PrimaryScreen.Bounds.Width){x = -5;y = 5;}}if (x>0 && y<0){if (lb.Left+lb.Width>=Screen.PrimaryScreen.Bounds.Width){x = -5;y = -5;}if (lb.Top<=0){x = 5;y = 5;}}if (x<0 && y<0){if (lb.Top<=0){x = -5;y = 5;}if (lb.Left<=0){x = 5;y = -5;}}if (x<0 && y>0){if (lb.Left <= 0){x = 5;y = 5;}if (lb.Top + lb.Height >= Screen.PrimaryScreen.WorkingArea.Height){x = -5;y = -5;}}}}
}
C#实现气泡屏保效果(用1个timer)相关推荐
- php气泡效果,js 模拟气泡屏保效果代码_其他特效
核心代码: var T$ = function(id) { return document.getElementById(id); } var $extend = function(des, src) ...
- 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 ...
- [ActionScript 3.0] 模拟win7彩色气泡屏保效果
主文件: package {import com.views.BubbleView;import com.views.ColorfulBubble;import flash.display.Sprit ...
- C#实现气泡屏保(四个timer实现)
四个timer实现气泡屏保 using System; using System.Collections.Generic; using System.ComponentModel; using Sys ...
- c#第二课,气泡屏保
回顾 属性赋值(4种) (1)直接赋值语法:15种数据类型 整数(8种) int uint short ushort long ulong- 浮点型(3种)double float decimal 布 ...
- C#实现气泡屏保(1个timer实现)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- Winform中实现自定义屏保效果(附代码下载)
场景 效果 注: 博客主页: https://blog.csdn.net/badao_liumang_qizhi 关注公众号 霸道的程序猿 获取编程相关电子书.教程推送与免费下载. 实现 新建form ...
- 【JavaGUI demo】swing仿Windows气泡屏保动画(含源码)
概述 java实现简单泡泡屏保动画及点击变实心泡泡,空格暂停动画 实现思路 采用MVC(Model-View-Controller(模型-视图-控制器))设计思路.将数据层与视图层与控制层分开. 在本 ...
最新文章
- 在大数据时代,每家公司都要有大数据部门吗?
- 程序员的一个好习惯,你有几个?
- python3.7是什么_Python 3.7 有什么新变化
- 让电脑说话代码_让您的代码为您说话
- Flutter布局锦囊---完善信息页
- Unicode Tips
- halcon学习之图像分割
- 轻量级java开发工具_C++主流开发工具推荐
- POJ2063 Investment(完全背包)
- (004)每日SQL学习:物化视图之二
- PeakDo毫米波无线投屏器,你的无线图传神器
- google已经启用www.guge.com(谷歌)域名
- Xcode6 安装 IOS7.1 Simulator
- 敏捷下的scrim、xp、3355、TDD、BDD、CI、DI及四个仪式、十二原则汇总
- 基于微信小程序的自习室预约系统设计与实现-计算机毕业设计源码+LW文档
- 一文详解IMU模型原理和标定选型
- 电脑什么软件都没开,运行内存就占满了
- CAN与CANOpen(一)
- 英语题目作业(12)
- 多国语言在线客服系统源码+软件下载二合一集成