日期:2014-05-17  浏览次数:20742 次

C#中picturebox控件
C#中picturebox控件怎样在播放视频的同时在上面画图啊,播放视频的时候总是会挡住在picturebox上画的线,但是我又需要在播放视频的同时画线,而且不要被视频挡住,就像是画图是在视频上画的

------解决方案--------------------
picturebox播放视频?播放过程中画线?
可以考虑在一个picturebox上覆盖一个透明容器,在透明容器上画线,下面的picturebox播放视频,这样就互不影响了

给你一个透明容器的代码,你参考修改一下
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

namespace COMMON
{
    public partial class TransparentInfo : System.Windows.Forms.UserControl
    {
        private string m_strInfo;
        public void ShowInfo(string strInfo) //透明容器上显示文字
        {
            m_strInfo = strInfo;
            this.Invalidate();
        }

        private void TransparentInfo_MouseEnter(object sender, EventArgs e)
        {
            this.Visible = true;
        }

        public bool drag = false;
        public bool enab = false;
        private Color fillColor = Color.White;
        private int opacity = 75; //默认透明度
        private int alpha;

        public TransparentInfo()
        {
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            SetStyle(ControlStyles.Opaque, true);
            this.BackColor = Color.Transparent;
        }

        public Color FillColor
        {
            get
            {
                return this.fillColor;
            }
            set
            {
                this.fillColor = value;
                if (this.Parent != null) Parent.Invalidate(this.Bounds, true);
            }
 &n