简体   繁体   中英

NSIS, set text color on specific words (not the all control)

I'm trying to have only specific words in a text area to be a certain color.

nsDialogs::Create 1018
Pop $0

; Text area
nsDialogs::CreateControl /NOUNLOAD ${__NSD_Text_CLASS} ${DEFAULT_STYLES}|${WS_CLIPCHILDREN}|${WS_TABSTOP}|${ES_WANTRETURN}|${ES_MULTILINE} ${__NSD_Text_EXSTYLE} 5 220 660 115 ''
Pop $1
SendMessage $1 ${EM_SETREADONLY} 1 0
SetCtlColors $1 0x000000 0xFFFFFF ; Black on white

${NSD_SetText} $1 "I want only the 'click me' to be blue ->CLICK ME<-"

nsDialogs::Show

How should I do to have only the 'CLICK ME' in blue letters ?

Thanks in advance for any help or hints.

The thing here is that it is still one single handle (

HDC

) for all text area.

Take a look at this sample: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162491(v=vs.85).aspx ; the

TextOut

method...

So, I really doubt that you have any better hasle-free ( including additional plugins ) option than simply use another text control ( split one text control into three text controls ).

Maybe Anders got some trick under the hood... :)

一个选项是一个标签位于另一个标签的顶部,另一个选项是使用带有RTF内容的RichEdit控件...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM