网上有 这样的做的 :1. 在Form上放一个WebBrowser,然后在其中显示Flash,把WebBrowser里网页的背景和Form的TransparentKey属性颜色设置相同色。
2. Form的FormBorderStyle设置为None。
3. 运行时默认窗体居中显示。
4. 在Form的Load事件里加上如下代码
webBrowser1.Navigate("about:blank");
while (webBrowser1.IsBusy)
{
Application.DoEvents();
}
string file = Application.StartupPath + @"\Face\" + "123.swf";
webBrowser1.Document.Write(string.Format("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"100%\" height=\"100%\"> <param name=\"wmode\" value=\"transparent\"><param name=\"movie\" value=\"{0}\"> <param name=\"quality\" value=\"high\"></object>", file));但是 如果这样做的话 有些透明的flash会有白色边框 怎么去掉它呢 或者 有没有更好的方法
2. Form的FormBorderStyle设置为None。
3. 运行时默认窗体居中显示。
4. 在Form的Load事件里加上如下代码
webBrowser1.Navigate("about:blank");
while (webBrowser1.IsBusy)
{
Application.DoEvents();
}
string file = Application.StartupPath + @"\Face\" + "123.swf";
webBrowser1.Document.Write(string.Format("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"100%\" height=\"100%\"> <param name=\"wmode\" value=\"transparent\"><param name=\"movie\" value=\"{0}\"> <param name=\"quality\" value=\"high\"></object>", file));但是 如果这样做的话 有些透明的flash会有白色边框 怎么去掉它呢 或者 有没有更好的方法
插入Flash后,有边框,请问如何去掉边框?
图片 :http://hi.csdn.net/attachment/200911/20/3199105_1258708190d8c1.jpg
为什么不可以做?只是一个弹窗,里面是 FLASH
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;namespace WindowsFormsApplication14
{
public partial class Form1 : Form
{
int CurrentIndex = 0; PictureBox PB = new PictureBox(); public Form1()
{
InitializeComponent(); this.FormBorderStyle = FormBorderStyle.None; PB.Parent = this;
PB.Dock = DockStyle.Fill; Timer T = new Timer();
T.Interval = 50;
T.Tick += new EventHandler(T_Tick);
T.Enabled = true;
} void T_Tick(object sender, EventArgs e)
{
Bitmap Bmp = new Bitmap(@"c:\10650_1257990499K1EN.gif");
int TotalCount = Bmp.GetFrameCount(FrameDimension.Time); // 帧数 Bmp.SelectActiveFrame(FrameDimension.Time, CurrentIndex);
using (Graphics G = Graphics.FromImage(Bmp))
Bmp.MakeTransparent(Bmp.GetPixel(0, 0)); // 第一个像素作为透明色
// gif支持透明,本来就透明
// 就更简单点 GraphicsPath GP = new GraphicsPath(); for (int i = 0; i < Bmp.Width; i++)
for (int j = 0; j < Bmp.Height; j++)
if (Bmp.GetPixel(i, j) != Color.Transparent)
GP.AddRectangle(new Rectangle(i, j, 1, 1)); PB.Image = Bmp;
PB.Region = new Region(GP);
this.Region = PB.Region;
CurrentIndex = (++CurrentIndex) % TotalCount;
}
}
}
其实不是很难
就简单情况来说 上网找个吸血鬼把flash打开
然后一般他们背景命名都有规律 跟咱平时做项目一样 一般是举例 背景 有可能是bg 或者是background color之类的 换个颜色 不编程的话读懂flash不难