开发者

Rich Text in ToolTip for C#

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.

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.Dra开发者_StackOverflow社区wBackground();
        newArgs.DrawBorder();
        newArgs.DrawText(TextFormatFlags.TextBoxControl);
    }
}


You can use this HTML renderer.


This is the newer version of HTML renderer @SLaks - https://htmlrenderer.codeplex.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜