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控件的兼容问题解决办法 引言 这几天受委托开发一个网络电视项目,要求初步先使用内嵌网页形式实现视频播放和选单,以后再考虑将网页中的所有功能整合进桌面程序. ...
随机推荐
- wordpress All in one Seo
原文地址:http://www.7adesign.com/155.html WordPress插件All-in-one-seo-pack详细设置: I enjoy this plugin and ha ...
- stl入门--reverse函数
#include<iostream> #include<algorithm> using namespace std; int main() { ch ...
- yield语句
自C#的第一个版本以来,使用foreach语句可以轻松地迭代集合.在C#1.0中,创建枚举器仍需要做大量的工作.C#2.0添加了yield语句,以便于创建枚举器.yield return语句返 ...
- JAVA File类 分析(三)
前面两篇与大家一起研究了unix下的文件系统,本篇将和大家一起分析 文件的属性和文件夹. ok,废话不说,先来段代码 #include <stdio.h> #include <sys ...
- OC中NSString 的常用方法
NSString *str1 = @"BeiJing"; NSString *str2 = @"beijing"; //全部转为大写 NSLog(@" ...
- 手工删除oracle的方法
大致方法如下: 1.删除物理文件 1.1.oracle安装文件. 1.2.系统目录下,program files文件下的oracle文件 2.注册表中大概有这么几个地方: hkey ...
- 查看oracle锁及解决办法
SQL> select t2.username,t2.sid,t2.serial#,t2.logon_time from v$locked_object t1, v$session t2 whe ...
- sublime text 2 安装
下载 http://pan.baidu.com/s/1eRemu0y http://jingyan.baidu.com/album/ff4116259b057c12e48237b8.html?pici ...
- Redis系列整理
0.Redis系列-安装部署维护篇 1.Redis系列-远程连接redis并给redis加锁 2.Redis系列-存储篇string主要操作函数小结 3.Redis系列-存储篇list主要操作函数小结 ...
- codeforces 几道题目
BZOJ挂了....明天就要出发去GDKOI了....不能弃疗. 于是在cf水了几道题, 写写详(jian)细(dan)题解, 攒攒RP, 希望GDKOI能好好发挥....... 620E. New ...