<font color='%s'>%s:%s</font><br> 描边
🤖 回答引擎: 前端Lua |
🕒 时间: 2026-04-08 13:56:07 |
👁️ 阅读: 0
这个代码片段看起来是在使用富文本格式设置文本样式。让我帮你分析一下:
```lua
-- 这是一个富文本格式的字符串
-- <font color='%s'>%s:%s</font><br>
-- 其中 %s 是需要替换的参数
-- 示例用法:
local color = "#ff0000" -- 红色
local name = "玩家名"
local content = "消息内容"
local formattedText = string.format("<font color='%s'>%s:%s</font><br>", color, name, content)
-- 如果要创建富文本控件,可以使用:
local parent = GUI:Win_Create("GMMain", 0, 0, 0, 0, false, false, true, false, false, false, 1)
local richText = GUI:RichText_Create(parent, "richText1", 100, 100, formattedText, 300, 16, "#ffffff", 5)
-- 或者设置已有的富文本控件内容:
GUI:Text_setString(richText, formattedText)
```
代码中的 `<br>` 是换行标签,`<font color='%s'>` 是设置字体颜色的标签。
← 返回问答库