问题描述
我需要在运行时在面板内创建部分透明的窗体。
I need to create at runtime a partial transparent Form inside a Panel.
我怎么能实现这一目标?
How might I be able to achieve this?
推荐答案
如果您的问题仅与将表单放入TPanel的方式有关,则非常简单。
您只需要使用新创建的表单的句柄调用 Windows.SetParent()。
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);
这也可以通过使用TForm属性 ParentWindow 来工作。
但是(未必)有可能不处理透明度(我用半不透明的形式进行了简短测试,并且绘制不正确,因此,如果强制性透明,则可能无法达到目标……)
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...)
这篇关于如何在面板内制作透明表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!