Hi Lil' Quaty,
Based on my investigation, you cannot make a control which insides a transparent Form in a .Net program.
However, I have an idea to figure your issue out, that is to create another form (assume Form2) to show the control, Form2 is topmost window, it has no title bar, no border, it do not show in the task bar, and contains a picture box. Please check the code snippets below.
Code Snippet
Transparent_Form_Demo
public partial class Form1 : Form
{
private Point f2_location;
private Form2 f2;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{//start here
this.Opacity = 0.50;
this.BackColor = Color.Black;
f2 = new Form2();
f2.Show();
f2.Opacity = 1.0;
f2.ShowIcon = false;
f2.ShowInTaskbar = false;
f2.FormBorderStyle = FormBorderStyle.None;
f2_location = this.Location;
f2_location.Offset(new Point(10, 30));
f2.Location = f2_location;
}
private void Form1_Move(object sender, EventArgs e)
{//move the form2 location when form1 was moved
if (f2 != null)
{
f2_location = this.Location;
f2_location.Offset(new Point(10, 30));
f2.Location = f2_location;
f2.TopMost = true;
}
}
}
Code Snippet
Transparent_Form_Demo
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
pictureBox1.Image = Image.FromFile("F:\\avato2r3.jpg");
pictureBox1.Location = new Point(0, 0);
pictureBox1.Size = pictureBox1.Image.Size;
//this.Size = pictureBox1.Size;
}
}
Regards,
Xun
|