墙头草的Blog
两边倒~~~两边倒~~技术上要坚持两边倒~~
博客园
社区
首页
新随笔
联系
管理
订阅
随笔- 114 文章- 0 评论- 19
用Flash OCX实现QQ魔法表情效果
效果图。
--------------------------------------------------------------------------------------------
最先想到的方法是Form的TransparentKey属性。只需把Flaxh ocx拉到窗体,
ocx控件背景颜色、窗休背景颜色和TransparentKey都设置相同的颜色值就可以实现透明了。
什么?实现不了?
嘿嘿,
把系统颜色改成16位色吧
!
于是找到了另一种方法........
完美方案:
在Form上放个WebBrowser,在WebBrowser中显示Flash,把WebBrowser Docuemt背景(默认是白色)和TransparentKey一致,
Form的FormBorderStyle高为none。
搞定,效果如上图。
贴上代码。
无常作品: msn :
wuchangx@hotmail.com
QQ: 3263262
Form2.Designer.cs
1
using
System.Windows.Forms;
2
namespace
abs.Agent
3
{
4
partial
class
Form2
5
{
6
/**/
///
<summary>
7
///
必需的设计器变量。
8
///
</summary>
9
private
System.ComponentModel.IContainer components
=
null
;
10
11
/**/
///
<summary>
12
///
清理所有正在使用的资源。
13
///
</summary>
14
///
<param name="disposing">
如果应释放托管资源,为 true;否则为 false。
</param>
15
protected
override
void
Dispose(
bool
disposing)
16
{
17
if
(disposing
&&
(components
!=
null
))
18
{
19
components.Dispose();
20
}
21
base
.Dispose(disposing);
22
}
23
24
Windows 窗体设计器生成的代码
#region
Windows 窗体设计器生成的代码
25
26
/**/
///
<summary>
27
///
设计器支持所需的方法 - 不要
28
///
使用代码编辑器修改此方法的内容。
29
///
</summary>
30
private
void
InitializeComponent()
31
{
32
this
.webBrowser1
=
new
System.Windows.Forms.WebBrowser();
33
this
.SuspendLayout();
34
//
35
//
webBrowser1
36
//
37
this
.webBrowser1.Dock
=
System.Windows.Forms.DockStyle.Fill;
38
this
.webBrowser1.Location
=
new
System.Drawing.Point(
0
,
0
);
39
this
.webBrowser1.MinimumSize
=
new
System.Drawing.Size(
20
,
20
);
40
this
.webBrowser1.Name
=
"
webBrowser1
"
;
41
this
.webBrowser1.ScrollBarsEnabled
=
false
;
42
this
.webBrowser1.Size
=
new
System.Drawing.Size(
505
,
302
);
43
this
.webBrowser1.TabIndex
=
0
;
44
//
45
//
Form2
46
//
47
this
.AutoScaleDimensions
=
new
System.Drawing.SizeF(6F, 12F);
48
this
.AutoScaleMode
=
System.Windows.Forms.AutoScaleMode.Font;
49
this
.ClientSize
=
new
System.Drawing.Size(
505
,
302
);
50
this
.Controls.Add(
this
.webBrowser1);
51
this
.FormBorderStyle
=
System.Windows.Forms.FormBorderStyle.None;
52
this
.Name
=
"
Form2
"
;
53
this
.Text
=
"
Form2
"
;
54
this
.TopMost
=
true
;
55
this
.TransparencyKey
=
System.Drawing.Color.White;
56
this
.Load
+=
new
System.EventHandler(
this
.Form2_Load);
57
this
.ResumeLayout(
false
);
58
59
}
60
61
#endregion
62
63
private
WebBrowser webBrowser1;
64
}
65
}
Form2.cs
1
using
System;
2
using
System.Collections.Generic;
3
using
System.ComponentModel;
4
using
System.Data;
5
using
System.Drawing;
6
using
System.Text;
7
using
System.Windows.Forms;
8
9
namespace
abs.Agent
10
{
11
public
partial
class
Form2 : Form
12
{
13
public
Form2()
14
{
15
InitializeComponent();
16
}
17
18
private
void
Form2_Load(
object
sender, EventArgs e)
19
{
20
webBrowser1.Navigate(
"
about:blank
"
);
21
while
(webBrowser1.IsBusy)
22
{
23
Application.DoEvents();
24
}
25
string
file
=
@"
file:///C|/1020110241.swf
"
;
26
webBrowser1.Document.Write(
string
.Format(
"
<object classid=\
"
clsid:D27CDB6E
-
AE6D
-
11cf
-
96B8
-
444553540000
\
"
width=\
"
222
\
"
height=\
"
186
\
"
> <param name=\
"
wmode\
"
value=\
"
transparent\
"
><param name=\
"
movie\
"
value=\
"
{
0
}
\
"
> <param name=\
"
quality\
"
value=\
"
high\
"
></object>
"
,file));
27
}
28
}
29
}
该文已被引用至:
http://www.netcsharp.cn/showtopic-595.aspx
Tag标签:
WinForm
,
Flash
posted @ 2008-04-02 16:35
墙头草
阅读(42)
评论(2)
编辑
收藏
所属分类:
WinForm
发表评论
回复
引用
查看
#1楼
2008-06-03 15:17 |
小隐任行
日,不行,不透明
回复
引用
查看
#2楼
[
楼主
]
2008-06-08 12:53 |
墙头草
嘿嘿,把系统颜色改成16位色吧!
社区
新闻
新用户注册
刷新评论列表
标题
姓名
主页
Email
(只有博主才能看到)
验证码
*
看不清,换一张
[
登录
][
注册
]
内容(请不要发表任何与政治相关的内容)
Remember Me?
登录
使用高级评论
新用户注册
返回页首
恢复上次提交
[使用Ctrl+Enter键可以直接提交]
所属分类的其他文章:
·
Winform中在Form上截取消息的两种方法
·
C#--WinForm获取本机网卡的型号,IP地址,子网掩码和网关
·
使用WMI获取驱动器列表
·
如何让DataGrid选中一行,而不是单元格
·
如何用C#在winform中实现简单的查找功能
·
Windows Message ID 常量列表
·
WinForm--窗体间传递复杂数据
·
WinForm--利用Event松耦合远程对象与远程系统
·
Winform控件 无闪烁走马灯效果
·
在Winform中如何实现ListView排序
最新IT新闻:
·
第一财经周刊:当前互联网世界正处无秩序时代
·
Visual Studio 2008 SDK 1.1 发布
·
死敌VMware变身微软认证计划新成员
·
英特尔雅虎开发网络计算机频道
·
Windows Live视频邮件9月9日开始测试
博客园新闻频道
博客园首页
社区
公告
hit counter
<
2008年4月
>
日
一
二
三
四
五
六
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
与我联系
发短消息
搜索
常用链接
我的随笔
我的空间
我的短信
我的评论
更多链接
我的参与
我的新闻
最新评论
我的标签
留言簿
给我留言
查看留言
我参加的小组
程序员音乐空间
ASP.NET
女程序员之家
创业交流
博客园上海俱乐部
英语听力
我的标签
C#(16)
Asp.net(13)
JavaScript(10)
JQuery(9)
WinForm(4)
WebService(3)
LINQ(2)
Silverlight(2)
控件(1)
索引器(1)
随笔分类
.Net FrameWork(1)
(rss)
Asp.Net(19)
(rss)
C#(25)
(rss)
JavaScript(13)
(rss)
LINQ(2)
(rss)
MSSQL(7)
(rss)
Oracle(1)
(rss)
SharePoint(8)
(rss)
SilverLight(2)
(rss)
WebService(5)
(rss)
WF(7)
(rss)
WinForm(14)
(rss)
WPF(2)
(rss)
面向对象技术(5)
(rss)
随笔档案
2008年7月 (1)
2008年6月 (8)
2008年5月 (43)
2008年4月 (52)
2008年3月 (10)
文章分类
Asp.Net
(rss)
WinForm
(rss)
相册
小松鼠
最新评论
1. re: Asp.net--ViewState机制由浅入深3
不好意思,有个地方错了 是在PreRender之后,Render之前保存ViewState
寒 基础不扎实 (KOG)
2. re: Asp.net--ViewState机制由浅入深3
不小心按了submit 靠继续上文,....._VIEWSTATE的大小是无影响的,也就是说我们默认不用禁用它这种情况一般是在对应控件无用户触发事件的情况下,例如一个TextBox,没有TextCha... (KOG)
3. re: Asp.net--ViewState机制由浅入深3
lz对ViewState研究过没,指自己试验+设计它的原理是否看过
很多时候ViewState禁用与否对_VI (KOG)
4. re: MOSS漫游(3):说说MOSS中的母版页
楼主换个布局吧,过了界的文字都看不到了,用"..."来代替了。 (一瞬间)
阅读排行榜
1. [翻译]C# Object Initialization[完整版](1214)
2. C#--WinForm获取本机网卡的型号,IP地址,子网掩码和网关(243)
3. 当AjaxForm遇上TinyMCE(231)
4. C#--多进程多线程访问数据库(191)
5. Windows Message ID 常量列表(188)
评论排行榜
1. [翻译]C# Object Initialization[完整版](4)
2. Asp.net--ViewState机制由浅入深3(3)
3. xmlHttpRequest实践之无刷新验证用户名(2)
4. 用Flash OCX实现QQ魔法表情效果(2)
5. C# 屏幕取词的方法(1)
60天内阅读排行
1. windows 2003 下IIS6.0出现Http错误403.1的解决(50)
2. XML节点排序的一种方法(26)
3. ASP.NET规范(24)
4. [方法“Boolean Contains(System.Guid)”不支持转换为 SQL]的解决办法(19)
5. Northwind库中表的说明(18)