Click here to Skip to main content
15,881,615 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii

I want to place a transaparent form over another form ,also the transaparent form should not go back on mouse click.It should act asa mdi .Is it possible.

Thanks in advance

Pls help...!!!!!!!!!1
Posted

You can try following.

C#
Form1.Controls.Add(Form2);


However it is not good practice. MDI is best option to be treated as parent for all the forms.


HTH
 
Share this answer
 
Comments
#realJSOP 1-Jul-10 7:53am    
You can't add a form as a control on another form.
If the form you're adding is transparent, what good is it? What purpose does it serve? BTW, just because the form is transparent dfoesn't mean you won't still get a border and titlebar (unless you also change the underlying window style).
 
Share this answer
 
v2
Try this. You can make your parent form a Multiple Document parent form by setting the IsMdiContainer property on the parent. Then on your child form, set the MdiParent property equal to the parent. Finally, show the form.

see snippet below.

Form1.IsMdiContainer = true;
Form2.MdiParent = Form1;
Form2.Show();


Is this what you want?
 
Share this answer
 
v4
Comments
#realJSOP 1-Jul-10 13:51pm    
Don't use textspeak. It's as rude as using all-caps.
BryanWilkins 1-Jul-10 14:19pm    
I'm afraid I don't understand. Textspeak? I guess you are saying that I should have explained the code I posted instead of just assuming that the simple code posted could speak for itself? Am I right? If so I apologize for the assumption.

Edit... Sorry, I just realized what you meant by textspeak. I modified my post to be a 'you' instead of a u. My bad. Sorry. I can't believe i did that. Weird since i know my phone corrects those that it translated into my typing. Wow.
#realJSOP 1-Jul-10 15:41pm    
It was the "u" instead of "you".
Yes thats what i want ,But its not working .Form2 goes back of Form1
 
Share this answer
 
I dont know if I understand what exactly you want, but here is something that should help you.

1- Add a new form to your project "Form 2"
2- Then you have two forms, so call the form number two through form number one.

Form2 randomname = new Form2();
randomname.ShowDialog();


3-Then in the Form2 Load you can control the transparency level usin this:

private void Form2_Load(object sender, EventArgs e)
{
    //Number o choice
    this.Opacity = 0.5;
}


Hope this help.
 
Share this answer
 
GDI Forms are not capable much of creating layers.

Why dont you move to WPF, that allows you more flexibility in this regard. I didnt give you a solution to your problem, as I can see lots of people already answered you.

WPF has the flexibility to draw transparent Canvas over the UI, the same as you do and also as it is an UIElement, it sticks with the form totally.

:cool:
 
Share this answer
 
Hii


An error saying "<b>Top Level Control cannot to be added to a control"..</b>
 
Share this answer
 
Comments
Toli Cuturicu 1-Jul-10 15:54pm    
Reason for my vote of 1
fake answer
BryanWilkins 2-Jul-10 11:31am    
Reason for my vote of 1
not an answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900