如何更改RTF文本中超链接的颜色

如何更改RTF文本中超链接的颜色

本文介绍了Inno Setup - 如何更改RTF文本中超链接的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用



如何使用语法更改RTF中更改RTF中的超​​链接颜色一个href =https://stackoverflow.com/a/23536287/850848> Oliver Bock的回答是什么是超链接的RTF语法?和上面的代码?

  {\ colortbl; \\\\\green0 \ blue238;} 
{\ field {\ * \fldinst HYPERLINKURL } {\fldrslt {\\\\cf1Text to display}}}


解决方案

实际上,在Windows 7上,默认情况下链接颜色不是蓝色(在Windows 10上)。



要强制使用的正确RTF语法某种链接颜色如下:

  RichView er.RTFText:= 
'{\rtf1'+
'{\ colortbl; \ red238 \ green0 \ blue {;''+
'Lorem ipsum dolor sit amet' +
'{\b {\ field {\ * \ fldinst {HYPERLINKhttps://www.example.com/}}'+
'{\ fldrslt {\\ \\ cf1 CLICK_HERE \cf0}}}}'+
'consectetur adipiscing elit。}';



I'm using code from How to add clickable links to custom Inno Setup WelcomeLabel?:

procedure InitializeWizard;
var
  RichViewer: TRichEditViewer;
begin
  RichViewer := TRichEditViewer.Create(WizardForm);
  RichViewer.Left := WizardForm.WelcomeLabel2.Left;
  RichViewer.Top := WizardForm.WelcomeLabel2.Top;
  RichViewer.Width := WizardForm.WelcomeLabel2.Width;
  RichViewer.Height := WizardForm.WelcomeLabel2.Height;
  RichViewer.Parent := WizardForm.WelcomeLabel2.Parent;
  RichViewer.BorderStyle := bsNone;
  RichViewer.TabStop := False;
  RichViewer.ReadOnly := True;
  WizardForm.WelcomeLabel2.Visible := False;

  RichViewer.RTFText :=
    '{\rtf1 Lorem ipsum dolor sit amet ' +
    '{\b {\field{\*\fldinst{HYPERLINK "https://www.example.com/" }}' +
    '{\fldrslt{CLICK_HERE}}}} ' +
    'consectetur adipiscing elit.}';
end;

And I want to change the color of the hyperlink to blue:

How do I use a syntax for changing changing hyperlink color in RTF from the answer by Oliver Bock to What is the RTF syntax for a hyperlink? with the above code?

{\colortbl ;\red0\green0\blue238;}
{\field{\*\fldinst HYPERLINK "URL"}{\fldrslt{\ul\cf1Text to display}}}
解决方案

Indeed, on Windows 7, the link color is not blue by default (it is on Windows 10).

The correct RTF syntax to force a certain link color is like:

RichViewer.RTFText :=
  '{\rtf1 ' +
  '{\colortbl ;\red238\green0\blue0;}' +
  'Lorem ipsum dolor sit amet ' +
  '{\b {\field{\*\fldinst{HYPERLINK "https://www.example.com/" }}' +
  '{\fldrslt{\cf1 CLICK_HERE\cf0 }}}} ' +
  'consectetur adipiscing elit.}';

这篇关于Inno Setup - 如何更改RTF文本中超链接的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 22:33