Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use a TListBox with style set to lbOwnerDrawFixed (if the size of the spacing isn't important) or lbOwnerDrawVariable if it is.</p> <p>You can then handle OnDrawItem &amp; OnMeasureItem accordingly.</p> <p>Using clWindow will be no problem, however AFAIK the orange color is not part of the Windows theme, but you can obtain something that will match the theme by starting from clHighlight and then applying a hue shift, then lightness shift for the shading.</p> <p>If your hue shift is constant, it'll automatically adapt to the theme colors.</p> <p>Sample code (without the HueShift for the orange): drop a TListBox, set lbOwnerDrawFixed, adjust ItemHeight to 28, set font to "Segoe UI" and use the following OnDrawItem</p> <p><img src="https://i.stack.imgur.com/UZgS7.jpg" alt="preview"></p> <pre><code>var canvas : TCanvas; txt : String; begin canvas:=ListBox1.Canvas; canvas.Brush.Style:=bsSolid; canvas.Brush.Color:=clWindow; canvas.FillRect(Rect); InflateRect(Rect, -2, -2); if odSelected in State then begin canvas.Pen.Color:=RGB(194, 118, 43); canvas.Brush.Color:=RGB(255, 228, 138); canvas.RoundRect(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, 6, 6); canvas.Pen.Color:=RGB(246, 200, 103); canvas.RoundRect(Rect.Left+1, Rect.Top+1, Rect.Right-1, Rect.Bottom-1, 6, 6); end; canvas.Font.Color:=clWindowText; canvas.Brush.Style:=bsClear; txt:=ListBox1.Items[Index]; Rect.Left:=Rect.Left+10; canvas.TextRect(Rect, txt, [tfLeft, tfSingleLine, tfVerticalCenter]); end; </code></pre> <p>If you're going to have more than one such components, it's of course preferable to just subclass TListBox, and if you want anti-aliasing for the RoundRect, GR32 or GDI+ can be used.</p> <p>Note that for backward compatibility with XP, "Segoe UI" font should be set dynamically, as it's not available in XP (in XP "Arial" is a good fallback, "Tahoma" looks closer but isn't guaranteed to be there)</p>
    singulars
    1. This table or related slice is empty.
    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. 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