在视频上叠加半透明圆

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;

namespace WindowsApplication132
{
   
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            GraphicsPath GP
= new GraphicsPath();
            GP.AddEllipse(
new Rectangle(0, 0, 50, 50));

            Bitmap Bmp
= new Bitmap(50, 50);
           
using (Graphics G = Graphics.FromImage(Bmp))
                G.FillEllipse(Brushes.Red,
new Rectangle(0, 0, 50, 50));

            Panel P
= new Panel();
            P.Name
= "P";
            P.BorderStyle
= BorderStyle.Fixed3D;
            P.Parent
= this;
       


            Form F
= new Form();
            F.Name
= "F";
            F.Size
= new Size(50, 50);
            F.FormBorderStyle
= FormBorderStyle.None;
            F.BackgroundImage
= Bmp;
            F.Opacity
= 0.5;
            F.Region
= new Region(GP);
            F.Show(P);
           
this.LocationChanged += new EventHandler(Form1_LocationChanged);
        }

       
void Form1_LocationChanged(object sender, EventArgs e)
        {
            Panel P
= (Panel)this.Controls.Find("P", true)[0];
            Application.OpenForms[
"F"].Location = P.PointToScreen(new Point(0, 0));
        }
    }
}

posted on 2009-11-30 15:39  forrestsun  阅读(417)  评论(0编辑  收藏  举报