C# winfrom中Flash播放使用axShockwaveFlash控件设置透明XP出现白色背景解决办法,仿QQ魔法表情效果
//播放时 图片周围有锯齿白边出现 反锯齿处理暂无解决办法、 如有大神 请给我留言
新Form AllowDrop True
引用using System.IO;
拖1个Button
public Form1()
{
InitializeComponent();
}
string fileName;
String extendedName;
String fileName1;
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog(); //new一个方法
ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); //定义打开的默认文件夹位置
ofd.ShowDialog(); //显示打开文件的窗口
fileName = ofd.FileName; //获得选择的文件路径
extendedName = Path.GetExtension(fileName); //获得文件扩展名
fileName1 = Path.GetFileName(fileName);
PlayFlash f = new PlayFlash(fileName);
f.Show();
}
//拖入
private void Form1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Copy;
}
}
//拖入操作释放
private void Form1_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] MyFiles = (string[])(e.Data.GetData(DataFormats.FileDrop));
if (MyFiles.Length > 0)
{
PlayFlash f = new PlayFlash(MyFiles[0]);//播放窗体传值
f.Show();//播放窗体显示
}
}
}
新建Form
拉一个webBrowser
拖1个timer
设计Form背景为透明等属性
/// <summary>
/// 存放Flash路径
/// </summary>
string playFile = "";
public string Isplay;
/// <summary>
/// 获取Flash路径并渲染窗体
/// </summary>
/// <param name="file"></param>
public Form1(string file)
{
playFile = file;
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//新的文档
webBrowser1.Navigate("about:blank");
//判断文档是否在加载
while (webBrowser1.IsBusy)
{
Application.DoEvents();
}
webBrowser1.Document.Write("<HTML>");
webBrowser1.Document.Write("<HEAD>");
webBrowser1.Document.Write("<TITLE>");
webBrowser1.Document.Write("</TITLE>");
webBrowser1.Document.Write("<script type='text/javascript' language='javascript'>");
webBrowser1.Document.Write("function a() {");
webBrowser1.Document.Write("var ab= document.swf.IsPlaying();");
webBrowser1.Document.Write("var d = document.getElementById('xxx');");
webBrowser1.Document.Write("d.value = ab;");
webBrowser1.Document.Write(" }");
webBrowser1.Document.Write("</script>");
webBrowser1.Document.Write("</HEAD>");
webBrowser1.Document.Write("<BODY>");
//网页效果输出Flahs
webBrowser1.Document.Write(string.Format("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"100%\" height=\"100%\" id=\"swf\"> <param name=\"wmode\" value=\"transparent\"><param name=\"movie\" value=\"{0}\"> <param name=\"quality\" value=\"high\"><param name=\"LOOP\" value=\"false\" /></object>", playFile));
webBrowser1.Document.Write("<input id=\"xxx\" type=\"hidden\" runat=\"server\" /></BODY>");
webBrowser1.Document.Write("</HTML>");
timer1.Interval = 50;
timer1.Enabled = true;
}
int sum = 0;
private void timer1_Tick(object sender, EventArgs e)
{
webBrowser1.Document.InvokeScript("a");
Isplay = webBrowser1.Document.All["xxx"].GetAttribute("value");
if (Isplay == "false")
{
timer1.Enabled = false;
this.Close();
}
sum = sum + 1;
if (sum > 100)
{
timer1.Enabled = false;
this.Close();
}
}
C# winfrom中Flash播放使用axShockwaveFlash控件设置透明XP出现白色背景解决办法,仿QQ魔法表情效果的更多相关文章
- qtp录制时间控件不允许用户手动输入的解决办法
qtp录制时间控件不允许用户手动输入的解决办法 [前面的话] 一边学习qtp,一边用自己的项目试着写代码,而遇到一个问题就会让自己卡壳很久,这次也是这样的,在写好了登录代码以后,自己就试着写第一个预订 ...
- ActiveX控件注册不起作用的解决办法
公司写了一个ActiveX打印插件.其中一个同事的电脑死活不能用.于是我就上网找办法 这位兄弟写的比较清晰. ActiveX交互时浏览器的设置以及ActiveX控件注册的检测 http://blog. ...
- qt 给父窗体设置样式不影响子控件样式以及子控件设置透明
1.父窗体样式不生效? this->setAttribute(Qt::WA_StyledBackground); 2.父窗样式体影响子控件? this->setStyleSheet(&qu ...
- 在创建窗口句柄之前,不能在控件上调用 Invoke 或 BeginInvoke 解决办法
增加IsHandleCreated 判断 if (this.IsHandleCreated) { this.Invoke(new EventHandler(delegate { ...... })); ...
- 2.QT浏览器控件设置“透明颜色”
使用样式表或者设置背景颜色,使用 background-color:transparent 但,使用透明的颜色是不可行的: QColor(255,0,0,0)
- 弹出框页面中使用jquery.validate验证控件
弹出框页面中使用jquery.validate验证控件有几个问题需要解决: 1,弹出框的提交事件完成后如何关闭弹出框页面? 2,提交不成功如何返回当前页? 3,如果知道验证事件成功? 之前笔者都是JS ...
- 示例:WPF中Slider控件封装的缓冲播放进度条控件
原文:示例:WPF中Slider控件封装的缓冲播放进度条控件 一.目的:模仿播放器播放进度条,支持缓冲任务功能 二.进度: 实现类似播放器中带缓存的播放样式(播放区域.缓冲区域.全部区域等样式) 实现 ...
- 交互式的Flash图表和仪表控件AnyChart
AnyChart使你可以创建出绚丽的交互式的Flash图表和仪表控件.是一款灵活的基于Adobe Flash和跨浏览器和跨平台的图表解决方案,被很多知名大公司所使用,可以用于仪表盘的创建.报表.数据分 ...
- WPF中不规则窗体与WebBrowser控件的兼容问题解决办法
原文:WPF中不规则窗体与WebBrowser控件的兼容问题解决办法 引言 这几天受委托开发一个网络电视项目,要求初步先使用内嵌网页形式实现视频播放和选单,以后再考虑将网页中的所有功能整合进桌面程序. ...
随机推荐
- gem update --system 302 错误 解决方案(转)
具体过程如下: 1.InstantRails-2.0安装后,在配置环境变量path中配置ruby/bin目录(如果系统中有多个RUBY,执行命令行的时候系统认的就是path中的) 2.进入DOS命令行 ...
- 【LeetCode练习题】Reverse Linked List II
Reverse Linked List II Reverse a linked list from position m to n. Do it in-place and in one-pass. F ...
- ubuntu 下node 环境的安装
1. 安装nodejs sudo apt-get install nodejs 注意:包名是nodejs 2. 建立node软连接 #找到nodejs位置 which nodejs # /usr/bi ...
- convert用法(数据库中原本储存的格式是Nvarchar,如何修改成datetime格式)
查询这张表得到的数据如图 select CONVERT(nvarchar,substring([purchase-date],1,4)) +'-'+CONVERT(nvarchar,substring ...
- hdu 5533 Dancing Stars on Me(数学,水)
Problem Description The sky was brushed clean by the wind and the stars were cold in a black sky. Wh ...
- android 边学边记 2015.10.16
1.Menu.FIRST在reference中描述为:First value for group and item identifier integers.我们可以理解为ID设置的最小数值. 2.se ...
- poj 3255 求次大最短路
Roadblocks Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 5508 Accepted: 2088 Descri ...
- uva 11524 - InCircle (二分法)
题意:三角形ABC的内切圆把它的三边分别划分成 m1:n1,m2:n2 和 m3:n3 的比例.另外已知内切圆的半径 r ,求三角形ABC 的面积. #include<iostream> ...
- iOS使用ffmpeg播放rstp实时监控视频数据流
一.编译针对iOS平台的ffmpeg库(kxmovie) 最近有一个项目.须要播放各种格式的音频.视频以及网络摄像头实时监控的视频流数据,经过多种折腾之后,最后选择了kxmovie,kxmovie项目 ...
- CentOS6.5与XP双系统安装
因为工作的须要,须要安装一个XP系统和一个CentOS系统.依照在网上找到的一些方法尝试了下,结果都不是非常理想.最后,经过尝试和寻找,找到了一个比較方便的方法. 一.分区 本人的电脑硬盘是500G, ...