开发者

Rich Text in ToolTip for C#

开发者 https://www.devze.com 2023-03-15 05:02 出处:网络
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 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

精彩评论

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