继承Panel控件然后重写方法
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace DynamicAndStaticImage
{
public class MyPanel : Panel
{
public MyPanel()
{
this.SetStyle(ControlStyles.SupportsTransparentBackColor |
ControlStyles.Opaque, true);
this.BackColor = Color.Transparent;
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle = 0x20;
return cp;
}
}
}
}截图是视频播放,视频控件右键是flash自带的右键,不能设置为自己需要的右键,再flash上面添加一个透明的panel控件,然后panel设置自己的右键
本文介绍了一种通过继承Panel控件并重写其方法来自定义Flash视频播放器右键菜单的方法。通过添加一个透明的Panel控件覆盖在Flash控件上,并设置此Panel的背景为透明,可以拦截Flash控件的鼠标事件,从而实现自定义右键菜单的功能。
1446

被折叠的 条评论
为什么被折叠?



