how to make a transparent form inside Panel?

不想你离开。 提交于 2019-12-11 05:08:42

问题


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

How might I be able to achieve this?


回答1:


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...)



来源:https://stackoverflow.com/questions/10742819/how-to-make-a-transparent-form-inside-panel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!