在工具提示富文本为C# [英] Rich Text in ToolTip for C#
本文介绍了在工具提示富文本为C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以扩展的工具提示和创建自己的RichToolTip,但我不明白我怎么能处理每行或每字格式。我可以添加一个用户可以点击控件?或图像等。
I can extend the ToolTip and create my own RichToolTip but I don't understand how I can handle formatting per line or Per word. Can I add controls which a user can click on ? or images etc.
我碰到的 RichTextBox的但是这是用C ++(MFC)及我想要的东西为C#或东西,我可以用C#中使用。有什么建议么? ?有没有我可以使用任何开源组件
I came across RichTextBox but this is written in C++ (MFC) & I want something for C# or something which I can use with C#. Any suggestions? Are there any open source components which I can use?
public class RichToolTip : ToolTip
{
public RichToolTip()
{
this.OwnerDraw = true;
this.Draw += new DrawToolTipEventHandler(OnDraw);
}
public RichToolTip(System.ComponentModel.IContainer Cont)
{
this.OwnerDraw = true;
this.Draw += new DrawToolTipEventHandler(OnDraw);
}
private void OnDraw(object sender, DrawToolTipEventArgs e)
{
DrawToolTipEventArgs newArgs = new DrawToolTipEventArgs(e.Graphics,
e.AssociatedWindow, e.AssociatedControl, e.Bounds, e.ToolTipText.Substring(0, 5),
this.BackColor, this.ForeColor, new Font("Arial Unicode MS", 8.25f, FontStyle.Bold));
newArgs.DrawBackground();
newArgs.DrawBorder();
newArgs.DrawText(TextFormatFlags.TextBoxControl);
}
}
推荐答案
您可以使用此HTML渲染器。
这篇关于在工具提示富文本为C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文