简体   繁体   English

如何使我的Deskband(任务栏工具栏)表单透明

[英]How to make my Deskband's (Taskbar Toolbar) Form transparent

I'm working on a Windows Deskband in Delphi XE2 for Windows XP, Vista and 7 (Win32 and Win64)... 我正在使用适用于Windows XP,Vista和7(Win32和Win64)的Delphi XE2中的Windows Deskband ...

I've implemented all the necessary interfaces (ITrayDeskBand, IDeskBandInfo, IDeskBand2, IDeskBand) in my code, and that all works exactly as it should (there are no warnings on Vista/7 complaining about compatibility as others have experienced). 我在我的代码中实现了所有必要的接口(ITrayDeskBand,IDeskBandInfo,IDeskBand2,IDeskBand),并且所有接口都完全正常(Vista / 7上没有任何警告抱怨其他人经历过的兼容性)。

The problem I have is that my Deskband Form appears with a non-transparent band. 我遇到的问题是我的Deskband表格显示为不透明的乐队。 Also, only certain Controls are displaying (in this case TBitBtn and TImage containing a PNG). 此外,仅显示某些控件(在这种情况下,TBitBtn和TImage包含PNG)。 I need it to display TEdit and TComboBox objects properly too, but they won't appear at all. 我需要它来正确显示TEdit和TComboBox对象,但它们根本不会出现。

I've tried enabling GlassFrame and SheetOfGlass properties on my Form, but this doesn't help one bit. 我已经尝试在我的表单上启用GlassFrameSheetOfGlass属性,但这没有任何帮助。

Furthermore, the Form itself is exceeding the top boundary of the Taskbar, meaning you cannot (for example) resize the Taskbar if the cursor is in-line with the top of the Taskbar immediately above my Deskband. 此外,表单本身超出了任务栏的顶部边界,这意味着如果光标与我的Deskband正上方的任务栏顶部一致,则不能(例如)调整任务栏的大小。

I believe there is something Delphi's VCL TForm type is doing behind the scenes which renders the TForm type incompatible as a Deskband container... but this is just a suspicion. 我相信德尔福的VCL TForm类型正在幕后做,这使得TForm类型与Deskband容器不兼容......但这只是一种怀疑。

Here's a screenshot illustrating the various problems: 这是一个截图,说明了各种问题:

在此输入图像描述

As you can see (above), the Deskband's Form is pale (instead of Transparent), it overlaps the top of the Taskbar (preventing resizing and Autohide triggering when the Taskbar is "hidden") 正如您所看到的(上图),Deskband的表格是苍白的(而不是透明的),它与任务栏的顶部重叠(防止在任务栏“隐藏”时调整大小和自动隐藏)

Any ideas? 有任何想法吗?

UPDATE 1 Okay, I have been playing around and noticed that a totally different behaviour is observed when creating a TToolBar control to be used for the Deskband, rather than a form: 更新1好的,我一直在玩,并注意到在创建用于Deskband的TToolBar控件时,观察到完全不同的行为,而不是表单:

在此输入图像描述

Notice there are three TToolButton controls (with their text virtually invisible due to the Glass theme)? 请注意,有三个TToolButton控件(由于Glass主题,它们的文本几乎不可见)? There should also be a TEdit and TComboBox between two separators, but these refuse to display at all. 在两个分隔符之间也应该有一个TEditTComboBox ,但这些完全拒绝显示。

Also notice the artefacting (the repetition of actual Taskbar Icons)? 还要注意人工制品(重复实际的任务栏图标)?

I'm not sure if this is a step in the right direction or not, but it might help you (or others) to deduce a solution! 我不确定这是否是朝着正确方向迈出的一步,但它可能会帮助您(或其他人)推断出一个解决方案!

Okay... I've finally figured this out, and it is the most absurd thing I've ever come across. 好吧......我终于想出来了,这是我遇到过的最荒谬的事情。

I'm posting my findings here for the benefit of others (to save you going through the nuisance I've just been through). 我在这里发布我的发现是为了别人的利益(为了拯救你经历我刚刚经历过的麻烦)。

To get all of the controls on your Deskband Form to display and function properly, simply set the Visible property of your Form (in the IDE designer) to True . 要使Deskband表单上的所有控件都能正常显示和运行,只需将表单的Visible属性(在IDE设计器中)设置为True

Ridiculous, I know, but it works and is easily repeatable. 可笑,我知道,但它的工作原理很容易重复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM