TransparencyKey Does Not Support very urgent

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hiello

I want Show a transparent Windows Form in Penel but When I set a Forms
Toplevel or Topmost property to false the Transarency Key does not support
and form open in not transparent mode.

How do i make transparent with not toplevel form.

Here is my code -

public void showform()
{
form2 frm = new form2();
frm.transparencykey = frm.Backcolor
frm.Toplevel = false;
frm.Parent = this.Panel1;
frm.show();
}

When I call above function form2 show in panel1 but non transparent
so anybody can help me to show form2 in panel1 and it should be transparent.

thanks in advance
 
Form transparency is enabled by the LayeredWindow API and only toplevel
windows can support transparency in this way.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Hi,

The purpose is We are trying to draw some graphics like circle,line etc. on
a movie which played in directshow window and direct show window show in a
panel and i want to show a trasperant form on the Directshow Video Window and
I want to move and resize the transparent form when the video window or it's
parent control resize so I want to open a trasparent form on video window
with the same parent panel

BLM
 
The trouble is that the Control based classes come with a certain amount of
baggage which makes bending them to this sort of task difficult.

I would be inclined to look for a better solution. If you're using
DirectShow maybe you could use DirectX to display the graphic. Alternatively
create a NativeWindow based top-level window that implemented the
LayeredWindow API's.

Hmm.. I wonder if this is even possible... DirectShow takes over a chunk of
screen at a very low level. I don't know if it's possible to draw on top of
that at-all.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Thanks for being with me

ok, Now the I am Found the handle of Ivideowindow and it's type is intptr
and I want to set Ivideowindow handle in the perent property of c# windows
form but the c# windows form parent property is control type could you please
help me how do I convert ivideowindow handle in control type from intptr

BLM
 
Hi, If I understand you correctly you're trying to make a control a
child-window of the video window. I don't know if this is possible and I
have no way of testing it.

This request doesn't fall under the GDI+ domain so I think you'd be better
off asking this over on one of the DirectX forums.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Thanks Powell

I got the solution in this senerio we can use Setparent API
Through this API we can sent a managed control parent to unmanaged control

[DllImport("user32.dll", SetLastError = true)] // SETLAST by us
public static extern int SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

SetParent(Form1s.Handle, hWndVideoWindow);

Thank you very much again for being with me

BLM
 
Back
Top