动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
  
   .Net → 阅读文章

 窗体启动特效

作者来源: 
阅读 数 220 人次 , 2006-3-29 4:35:00 

【思路】:

在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;

 本文Tags特效  
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:已到记录最尾端
· 下一篇:用ImessageFilter接口实现截获键盘消息
· 如何用Visual C#做组件
· asp.net三种重定向方法的总结
· 在asp.net下将log4net配置成可log到ms sql
· 运行时拉伸和移动控件的类
· Allaire JRUN 2.3远程执行任意命令漏洞 


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077