Is there a managed shortcut control?

I would like to select a managed shortcut control like the one shown in the screenshot. This can be done with TEdit fieldless, but I was wondering if there is another way to work with gradient background?

example http://usera.ImageCave.com/brk303/SelectableLabel.png.jpg

To clarify, I use a simple PageControl, which with Win XP has a gradient drawing, without TEdit fields, placed on the page, does not fit perfectly:

Edit on the Control page http://usera.ImageCave.com/brk303/Gradient.png.jpg

Update:

I managed to get half way 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; 

Now it is transparent, but something else needs to be done, since painting when choosing text does not work properly. The behavior is hard to explain, I will investigate further and update here ...

+4
source share
2 answers

Labels are not editable. TLabel cannot even get focus because it is not inherited from TWinControl.

I would use TEdit to emulate your screenshot:

 object Edit1: TEdit BorderStyle = bsNone ParentColor = True ReadOnly = True Text = 'Editable label' end 

(you can copy and paste the specified code into the form)

+7
source

The usual way is to use borderless ( BorderStyle := bsNone ) and read-only ( ReadOnly := true ) TEdit , possibly in combination with Color := clBtnFace , as you say. However, gradient backgrounds are not common, and there is no ready-made support for them. However, it is not too difficult to do it yourself. I will try to find a simple solution in a few minutes.

Update

Drawing in Windows editing windows is not trivial. Are you sure you need a gradient background? Of course, you could write your own control - writing a ted-like control is actually not that difficult. I have done this several times. ( Proof )

Update 2

I have not tried it myself, and this may not work with visual themes, but you can try to create a transparent TEdit control: http://www.delphi3000.com/articles/article_935.asp?SK= Affairs>

Now I tried, and it does not work at all under Windows 7 with Aero.

+2
source

All Articles