添加 TForm 或 Panel.Transparent 的快捷方式?
为了阻止吹毛求疵的人,让我首先,我在这里搜索并找不到答案,是的,我也滚动浏览了“类似问题”。 向 TForm 添加快捷方式
我想将一些快捷方式从桌面拖放到应用程序中的 TForm。我正在使用 Anders Melander 出色的 Drag Drop Suite (DDS)。
我尝试在表单上放置一个 TImage,但 DDS 不会下降到图像,因此我添加了一个带有 TImage 的 TPanel。然后我可以将其放在面板上并将图像分配给 TImage.Picture。问题是面板没有透明属性,因此表单上的快捷方式看起来很笨重,后面有可见的面板。
我需要能够拖放到 TImage 或使底层 TPanel 透明。
任何人都可以帮助提供这些选项的代码片段,或者更好的是,将快捷方式直接拖放到我的表单上的方法。
谢谢
To thwart the nit-pickers, let me start with, I searched here with this and could not find an answer, and yes, also I did scroll through the "Similar questions."...
Adding shortcuts to a TForm
I want to drag and drop some shortcuts from the Desktop to a TForm in my application. I am using Anders Melander's brilliant Drag Drop Suite (DDS).
I tried putting a TImage on the form but the DDS does not drop to an Image so I added a TPanel with a TImage on it. I could then drop on the panel and assign the image to the TImage.Picture. Problem was the Panel has no Transparent Property so the shortcut on the form looks clunky with the visible Panel behind it.
I need to be able to drop to the TImage or make the underlying TPanel transparent.
Can anyone help with code-snippets for either of those options, or better yet, a method of dropping a Shortcut directly on to my Form.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
巧合的是,我需要使 TWinControl(带有窗口句柄的每个可见控件的基础,包括 TPanel)透明。我找到了很多结果,并将它们应用到这个答案。
我已经有一段时间没有实现拖放了,但我假设您调用了一些 API 并将面板的句柄传递给它?这就回答了为什么不能使用 TImage 的问题。 TImage 是一个图形控件,一个没有句柄的控件,它依赖于其父级来接收消息并绘制自身。
不过,应该可以使用该表单,因为它也有一个句柄。
Coincidentally I needed to make a TWinControl (the base for every visible control with a window handle, including TPanel) transparent. I found numerous results and applied them to this answer.
It's been a while since I implemented drag and drop, but I assume you call some API and pass it the handle of the panel? That answers the question why you can't use TImage. TImage is a graphic control, a control without a handle, that relies on its parent for recieving messages and drawing itself.
It should be possible to use the form, though, since that has a handle too.
如果
TImage
直接位于TForm
上,则让TForm
处理放置,无需TPanel
。 OLE 拖放操作(Ander 的组件实现)提供发生拖放的坐标。TForm
应该能够检测拖动何时经过TImage
占据的区域以及正在拖动的数据类型,并且只允许删除该区域内支持的类型区域,提取删除的数据并根据需要更新TImage
,并拒绝任何不符合该条件的其他内容。If the
TImage
is directly on theTForm
, then let theTForm
handle the drop, noTPanel
needed. OLE Drag&Drop operations (which Ander's components implement) provide coordinates where dragging and dropping occurs. TheTForm
should be able to detect when a drag is over the area occupied by theTImage
and what type of data is being dragged, and only allow dropping of supported types within that area, extracting the dropped data and updating theTImage
as needed, and denying anything else that does not match that criteria.