Reputation: 1417
I have a system windows forms where i show the web browser control over the media-player control as shown in image below,
I want to make Transparent web browser control. I have try many things but i am not able to make transparency over web browser control, i have try :
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.BackColor = Color.FromArgb(0, 0, 0, 0);
this.TransparencyKey = Color.Red;
this.BackColor = Color.Magenta;
this.TransparencyKey = Color.Magenta;*/
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.BackColor = Color.Transparent;
My code is :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.DirectX.AudioVideoPlayback;
using System.Windows.Forms;
namespace Windows_Video
{
public partial class Form1 : Form
{
Video vdo;
public string mode = "play";
public string PlayingPosition, Duration;
public Form1()
{
InitializeComponent();
// VolumeTrackBar.Value = 4;
}
private void Form1_Load(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
this.textBox1.Text = openFileDialog1.FileName;
}
axWindowsMediaPlayer1.URL = textBox1.Text;
axWindowsMediaPlayer1.Ctlcontrols.play();
}
private void button1_Click(object sender, EventArgs e)
{
/* OpenFileDialog openFileDialog1 = new OpenFileDialog();
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
this.textBox1.Text = openFileDialog1.FileName;
}*/
}
private void button2_Click(object sender, EventArgs e)
{
// axWindowsMediaPlayer1.URL = textBox1.Text;
// axWindowsMediaPlayer1.Ctlcontrols.play();
}
private void button3_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
//this.BackColor = System.Drawing.Color.Transparent;
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.BackColor = Color.Transparent;
}
}
}
Upvotes: 0
Views: 1744
Reputation:
you have to make another form with a web browser control set the opacity 50%
in the form properties
and then call on button or by some other method it will be work:
private void button1_Click(object sender, EventArgs e)
{
Form2 min = new Form2();
min.Show();
}
By this technique u can set the opacity
over web browser control/full form
Upvotes: 1