I'd like a selectable label control, like the one in the screenshot. It could be done with a borderless TEdit, but I was wondering if there is another way that would work with gradient background?
To clarify, I'm using a simple PageControl, which since Win XP has gradient drawing, a borderless TEdit placed on a page doesn't blend in perfectly:
Update:
I managed to get half way there by adding
procedure CNCtlColorStatic(var AMsg: TWMCtlColorStatic); message CN_CTLCOLORSTATIC;
procedure TTransparentEdit.CNCtlColorStatic(var AMsg: TWMCtlColorStatic);
begin
with ThemeServices do
if ThemesEnabled then
begin
SetBkMode(AMsg.ChildDC, Windows.TRANSPARENT);
DrawParentBackground(Handle, AMsg.ChildDC, nil, False);
AMsg.Result := GetStockObject(NULL_BRUSH);
end
else
inherited;
end;
It's now transparent, but something else needs to be done, as painting when text is selected doesn't work properly. The behavior is hard to explain, I will investigate further and update here...