窗体启动特效
来源:互联网 发布:c与c加加 java 编辑:程序博客网 时间:2024/06/01 15:03
【效果图】
【思路】:
在Form的OnLoad中 先使Form不可见,然后从内向外,一层一层绘制Rectangle ,最后让Form可见
【难点】
首先输出效果的Rectangle要有个地方显示,Main Form可不行,因为当绘制Rectangle的时候 ,Form是不可见的,这里使用了Desktop桌面
【代码如下】
1. 加入命名空间
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
2. 声明Win32 Api GetDC()
[ DllImport("user32") ]
public static extern System.IntPtr GetDC(System.IntPtr dc);
3. 声明变量
System.Drawing.Graphics g; //画图板
Pen p=new Pen(Color.Black,1); //画笔
int startx,starty,wx,wy,step; //startx,starty,wx,wy确定一个矩形
int cx,cy; //cx,cy为form的client的width 和height
4.在Form的OnLoad上加上如下代码
this.Visible=false;
step=1;
g=Graphics.FromHdc(GetDC(System.IntPtr.Zero));
cx=this.ClientSize.Width;
cy=this.ClientSize.Height;
this.Visible=false;
step=1;
while(step<=cx/2)
{
startx=cx/2-step;
starty=cy*startx/cx;
wx=2*step;
wy=wx*cy/cx;
startx+=this.Left;
starty+=this.Top+this.Height-this.ClientSize.Height;
g.DrawRectangle(p,startx,starty,wx,wy);
System.Threading.Thread.Sleep(100);
step+=10;
}
this.Visible=true;
ps:这是第一次发表原创, 大家多多指教
- 窗体启动特效
- 窗体动态特效集锦
- 轻松制作特效窗体
- VB.NET特效窗体
- 窗体特效,,左右移动
- JavaScript窗体打开特效
- C#窗体渐变特效
- winform窗体特效
- 简单的窗体特效
- winform 窗体特效
- Winform 弹出窗体 - 显示特效
- winform技巧—窗体特效
- VB.NET制作特效窗体
- xp下编程实现窗体透明特效
- 用BCB实现窗体动画特效
- 窗体特效:慢慢从透明到不透明
- Win2000下编程实现窗体透明特效
- 用VB.NET轻松制作特效窗体
- Weblogic 学习系列一: Weblogic Server 安装
- Weblogic 学习系列二: Domain and Server 配置
- Weblogic 学习系列三: Weblogic 与 JBuilder 的整合
- 快速初始化内存(1)
- 快速初始化内存(2)
- 窗体启动特效
- 中国日历类
- 在VC中用CMenuXP使应用程序拥有Office XP风格的界面
- 着色器和效果——0 概览
- 着色器和效果——1.0 介绍高级着色语言
- 着色器和效果——1.1编写HLSL着色器
- 着色器和效果——1.2 编译HLSL着色器
- 着色器和效果——1.3 变量类型
- 着色器和效果——1.4 关键字、语句和强制转换