Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
换句话说,如果我有:
var ll = new LinkLabel(); ll.Text = "Some links go here."; ll.Links.Add(0, 4); // Some ll.Links.Add(11, 2); // go
是否有任何方法可以调用以将“Some”链接的文本替换为其他内容,同时保持“go”链接相同。
我只想知道是否有内置方法。这并不难编码,我只是不想重新发明轮子。
当然,我查阅过 LinkLabel 文档,但有时方法会隐藏在意想不到的地方。
据我所知,您必须同时更改文本并修改链接,使其与更新文本的正确子字符串相对应。
一个更简单的解决方案可能是让 FlowLayoutPanel 包含单独的控件:带有文本“Some”的 LinkLabel、带有文本“links”的 Label、带有文本“go”的 LinkLabel 和带有文本“here.”的 Label。这样,您最终会得到一个外观相似的 UI,但可以调整各个项目,而不必费劲。