Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
270
Image in TooltipFormattedText
posted

AS per this link http://help.infragistics.com/Help/Doc/WinForms/2016.1/CLR4.0/html/WinToolTipManager_Creating_a_Formatted_ToolTip.html, we are trying to assign html formatted text to show tool tip for a text editor.

Here is a formatted text we have formed:

<div id='title' style='font-weight:bold;font-size:11.00pt;'>GAS FSFTG-11 - Gastite 3/4&quot;&quot; Flashshield Str<br />Male Ftg&edsp;&edsp;&edsp;&edsp;<span style='background-color:DarkBlue;color:White;font-weight:bold;'>&edsp;&edsp;Active&edsp;&edsp;</span></div><br /><div id='body' style='font-size:9.00pt;'>

<img style='margin:5px 5px;width:250px;height=250px' src='https://cdn.lightsamerica.com/images/555763.jpg'/>

</div>

So our issue is with the img tag which is trying to display an image from a url. We can see that there is limited html support for these tags in there. But I need a method to scale this image but also to keep the width height ratio of the actual image the same. I need to set a max width/max height. and set object-fit to contain. I found out that object-fit does not work here. Is there some other in built method for this?

Thanks

  • 7535
    Offline posted


    Hello ,

    Thank you for posting. There is no such inbuilt method for that but what you could do is get the image yourself in the code and resize it, then there's a method to encode the image as text instead of pointing to the URL. So you pass an image into that and it returns the image encoded into a string which you can then stick into an image tag.

    Something like this :
    string image = FormattedLinkEditor.EncodeImage(this.imageList1.Images[0]);

    For more information you can also refer this online help document:

    https://es.infragistics.com/help/winforms/wintooltipmanager-creating-a-formatted-tooltip

    Let me know if you any question.

    Sincerely,

    Divya Jain

    Associate Software Developer