1

I need to create at runtime a partial transparent Form inside a Panel.

How might I be able to achieve this?

cicerosf
  • 75
  • 8
  • Looks like you are trying to use the wrong tool - forms are not normally embedded into window controls such as TPanel (though there exist exceptions). Also if memory serves only parentless windows with caption can be transparent (but I can be wrong here). – Eugene Mayevski 'Callback May 24 '12 at 18:02
  • 4
    Have you seen the question from yesterday? [How to make a TFrame (and everything on it) partially transparent](http://stackoverflow.com/q/10708488/33732) – Rob Kennedy May 24 '12 at 18:42

1 Answers1

2

If your question is only related to the way to put the form in a TPanel then it's quite easy. You only need to call Windows.SetParent() with the handle of the newly created form.

MyNewForm := TMyNewForm.Create(Self); 
Windows.SetParent(MyNewForm.Handle,MyPanel.Handle);

This would also work by using the TForm Property ParentWindow. But it's (quite) possible that the transparency is not handled (I briefly tested with a semi opaque form and it's not drawn correctly, So if the transparency is mandatory it mights be impossible to reach your goal...)

klause8
  • 21
  • 1
  • Hi. thank you, but when a set the parent, I cannot do make it transparent. I need somethink like "break the parent style". Actually, I need to put any TwinControl in a Panel and make this TWinControl transparent. Or could be a TwinControl in a another one TWinControl. I dont know if I'm clear. sorry. Thank you. – cicerosf May 25 '12 at 20:38