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控件的兼容问题解决办法 引言 这几天受委托开发一个网络电视项目,要求初步先使用内嵌网页形式实现视频播放和选单,以后再考虑将网页中的所有功能整合进桌面程序. ...
随机推荐
- C语言的本质(28)——C语言与汇编之用汇编写一个Helloword
为了更加深入理解C语言的本质,我们需要学习一些汇编相关的知识.作为最基本的编程语言之一,汇编语言虽然应用的范围不算很广,但是非常重要.因为它能够完成许多其它语言所无法完成的功能.就拿 Linux 内核 ...
- 二探ListView
使用draw9patch 打开内置terminal 输入CD C:\Users\Gaby\AppData\Local\Android\sdk 在该目录下输入draw9patch 导入图片,开始绘制 本 ...
- PHP的优点
1.语法简单 2.学习成本低 3.开发效率高 4.跨平台 5.开发部署方便 6.开源框架非常丰富(如:ThinkPHP) 7.开源CMS系统非常丰富(如:Joomla,Wordpress) 8.开源网 ...
- 解决未能启动服务“VMware Authorization Service”
计算机-管理-服务--服务列表找到VMware Authorization Service 并双击 打开服务.
- TimeSpan类【转】
TimeSpan ts1 = new TimeSpan(DateTime.Now.Ticks); //获取当前时间的刻度数 //执行某操作 ............................ . ...
- Fix Elementary Boot Screen (plymouth) After Installing Nvidia Drivers
Q:I just installed propietary nvidia drivers, after that the glowing “e” plymouth theme was gone, on ...
- C# DropDownList绑定文件夹
首先创建一个类,类名称为FileControl, /// <summary> /// 获取制定文件夹下面的文件夹 /// </summary> /// <param na ...
- 点击TextView浏览器打开指定网页
直接上代码: /** * 点击跳转到版权页面 */ private void getCopyRight() { // TODO Auto-generated method stub TextView ...
- Spring-----自定义属性编辑器
转载自:http://blog.csdn.net/hekewangzi/article/details/51712963
- Flink Program Guide (9) -- StateBackend : Fault Tolerance(Basic API Concepts -- For Java)
State Backends 本文翻译自文档Streaming Guide / Fault Tolerance / StateBackend ----------------------------- ...