3

I need to change the color of the links in a SysLink control. There is an article on changing the color of SysLink controls, but it deals only with changing the color of the whole control, which makes the color of links the same as the color of the normal text.

The reason I need to change the color of the links is because the SysLink control will be on a background of a color close to the default link color, which makes the links unreadable.

A picture is better than 1000 words:

enter image description here

  1. This is the default SysLink appearance
  2. I can achieve this
  3. In can achieve this (same as 2 but all black)
  4. But I'm unable to achive this.
  5. I can achieve this (same as 2 but links keep default color).

My impression is that you can only either change the color of all text (including links) in the control (2,3) or change the color of text and leaving alone the default color of the links (5), but not change explicitely the color of the links (4).

Is there some Windows specialist that can shed some light on this matter?

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
  • 1
    Three controls in a row? (static+syslink+static). Or RichEdit control with the link? To color single control parts you need it to support custom draw, and this one doesn't... – Vlad Feinstein Aug 20 '21 at 19:33
  • @VladFeinstein unfortunately this is complicated, because the content of the control is generated dynamically. RichEdit might be a viable option though. It's a shame that MS has done only half of the job when they created this control. It would have been simple to add the possibility to change the color of links with the LM_SETITEM message. – Jabberwocky Aug 20 '21 at 19:37
  • 1
    Not "THAT" complicated; you can create a control that hosts those three controls and re-positions them when the content changes. And yes, MS *could* implement that in its `SysLink` :) – Vlad Feinstein Aug 20 '21 at 19:41
  • 2
    Yeah it doesn't support changing the colour, it seems hard-coded to use `GetSysColor(COLOR_HOTLIGHT)` unfortunately. You could always use Detours to hook `GetSysColor()` I guess. – Jonathan Potter Aug 20 '21 at 21:09
  • Keep in mind where this control came from. In Windows2000 it was a private control and basically only used in a handful of places. – Anders Aug 27 '21 at 02:57

0 Answers0