We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Image loaded from a resource file

Thread ID:

Created:

Updated:

Platform:

Replies:

41794 Mar 11,2006 07:46 PM Jul 5,2006 07:52 PM Windows Forms 4
loading
Tags: HTMLUIControl
Neil Conway
Asked On March 11, 2006 07:46 PM

Has anyone been able to load an image from a resource file into an htmlui control? I have not seen an example of this and can only figure out how to pull an image off of a windows directory. This would be useful because resource files make the entire application more portable. Any comments would be appreciated.

Nandakumar R [Syncfusion]
Replied On March 13, 2006 08:17 AM

Hi Neil, Thanks for the feedback. Loading an image file from a resource in to an HTMLUI control will be a good feature to have. I will put in a feature request to enable methods to load images from stream in to the HTMLUI control to our developers. HTMLUI control supports using custom controls into the htmlui control. Please refer the sample attached. The html file contains an image tag with the ''ImageFromStream'' attribute. At run time the sample replaces a PictureBox for the image tag and renders the embedded image from the stream. Hope this helps. Thanks for your interest in EssentialHTMLUI. Regards, Nanda.

LoadImageFromResource_41794.zip

Neil Conway
Replied On March 15, 2006 08:28 PM

Thank you for taking the time to create that example, Nanda. It was very informative. That will serve as a good workaround. Regards, Neil Conway

Administrator [Syncfusion]
Replied On July 4, 2006 05:50 AM

Hi, in the version 3.0.1 it was possible to connect to the NoImage-event of the img-elements in the PreRenderDocument event. If the src-attribute targeted a non existing file, the NoIMage-event was fired and you could supply a stream (e.g. from a resource) and a key to make the control render the image. Unfortunately this does no longer work in 4.2. Perhaps this helps Regards rainer BTW: is it possible to reactive the behaviour from 3.0.1?

Nandakumar R [Syncfusion]
Replied On July 5, 2006 07:52 PM

Hi Rainer, Thank you for your interest in Essential HTMLUI. In the 4.2.0.37 version of Syncfusion Essential Studio, we can easily load an image in the HTMLUI control from stream to the IMGElementImpl object. Please refer the following code snippet. [C#] using System.IO; using Syncfusion.Windows.Forms.HTMLUI; Assembly assembly = Assembly.GetExecutingAssembly(); Stream imageStream = assembly.GetManifestResourceStream("LoadImageFromResource.image.bmp"); IMGElementImpl img = this.htmluiControl1.Document.GetElementByUserId("img") as IMGElementImpl; img.Image = Image.FromStream(imageStream) as Bitmap; //The previous line can be replaced with the following commented statement. //img.Image = Syncfusion.HTMLUI.Base.Utility.Utilities.ImageFromStream(imageStream); Please refer the attached sample that uses the above mentioned steps to load an image from the stream in the HTMLUI control. I have requested our developers to look in to the NoImage event failure. I will get back to you with the suggested fix at the earliest. Thank you for your extensive feedback. Regards, Nanda ImageFromStream.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;