Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="http://docwiki.embarcadero.com/Libraries/en/Vcl.StdCtrls.TLabel" rel="nofollow noreferrer">TLabel</a> component doesn't use styles hooks because is not a <a href="http://docwiki.embarcadero.com/Libraries/en/Vcl.Controls.TWinControl" rel="nofollow noreferrer">TWinControl</a> descendant, so you can't use the <a href="http://docwiki.embarcadero.com/Libraries/en/Vcl.Themes.TCustomStyleEngine.UnRegisterStyleHook" rel="nofollow noreferrer"><code>UnRegisterStyleHook</code></a> function. Instead you must override the <strike>Paint</strike> <a href="http://docwiki.embarcadero.com/Libraries/en/Vcl.StdCtrls.TCustomLabel.DoDrawText" rel="nofollow noreferrer"><code>DoDrawText</code></a> method.</p> <p><strong>UPDATE</strong></p> <p>Here you have a sample of how override the paint process of a TLabel.</p> <pre><code>//declare this code in the implementation part uses Vcl.Themes, Vcl.Styles; type TLabelHelper= class helper for TCustomLabel procedure DrawNormalText(DC: HDC; const Text: UnicodeString; var TextRect: TRect; TextFlags: Cardinal); end; { TLabelHelper } procedure TLabelHelper.DrawNormalText(DC: HDC; const Text: UnicodeString; var TextRect: TRect; TextFlags: Cardinal); begin Self.DoDrawNormalText(DC, Text, TextRect, TextFlags); end; { TLabel } procedure TLabel.DoDrawText(var Rect: TRect; Flags: Integer); const EllipsisStr = '...'; Ellipsis: array[TEllipsisPosition] of Longint = (0, DT_PATH_ELLIPSIS, DT_END_ELLIPSIS, DT_WORD_ELLIPSIS); var Text, DText: string; NewRect: TRect; Height, Delim: Integer; begin Text := GetLabelText; if (Flags and DT_CALCRECT &lt;&gt; 0) and ((Text = '') or ShowAccelChar and (Text[1] = '&amp;') and (Length(Text) = 1)) then Text := Text + ' '; if Text &lt;&gt; '' then begin if not ShowAccelChar then Flags := Flags or DT_NOPREFIX; Flags := DrawTextBiDiModeFlags(Flags); Canvas.Font := Font; if (EllipsisPosition &lt;&gt; epNone) and not AutoSize then begin DText := Text; Flags := Flags and not DT_EXPANDTABS; Flags := Flags or Ellipsis[EllipsisPosition]; if WordWrap and (EllipsisPosition in [epEndEllipsis, epWordEllipsis]) then begin repeat NewRect := Rect; Dec(NewRect.Right, Canvas.TextWidth(EllipsisStr)); DrawNormalText(Canvas.Handle, DText, NewRect, Flags or DT_CALCRECT); Height := NewRect.Bottom - NewRect.Top; if (Height &gt; ClientHeight) and (Height &gt; Canvas.Font.Height) then begin Delim := LastDelimiter(' '#9, Text); if Delim = 0 then Delim := Length(Text); Dec(Delim); if ByteType(Text, Delim) = mbLeadByte then Dec(Delim); Text := Copy(Text, 1, Delim); DText := Text + EllipsisStr; if Text = '' then Break; end else Break; until False; end; if Text &lt;&gt; '' then Text := DText; end; if Enabled or StyleServices.Enabled then DrawNormalText(Canvas.Handle, Text, Rect, Flags) else begin OffsetRect(Rect, 1, 1); Canvas.Font.Color := clBtnHighlight; DrawNormalText(Canvas.Handle, Text, Rect, Flags); OffsetRect(Rect, -1, -1); Canvas.Font.Color := clBtnShadow; DrawNormalText(Canvas.Handle, Text, Rect, Flags); end; end; end; </code></pre> <p>before to use it declare an <em>interposer class</em> in this way</p> <pre><code> TLabel = class (Vcl.StdCtrls.TLabel) procedure DoDrawText(var Rect: TRect; Flags: Longint); override; end; </code></pre> <p>And this is the result</p> <p><img src="https://i.stack.imgur.com/STWp5.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload