Question

I'm creating a UI Design for my application in VB.Net with the help of HTML5 and CSS3 and Awesomium WebControl.

In my application I have to fetch binary data from a database and convert it to an Image Object and I have to show the Image in the application. The problem is that I want my UI Design to be full html and css and I don't know how to pass an Image Object in .NET to the Awesomium WebControl in a way that it show the image in html element.

Or in another way: For Example: How to pass my "My.Resources.MyImage" object to the Awesomium WebControl?

Dim img As System.Drawing.Image = My.Resources.MyImage
WebControl1.   <----------- How To Pass The Object to the Control?

Thank you in advance.

Was it helpful?

Solution

Awesomium is actually designed exactly for scenarios such as this.

The best way to achieve this in 1.7 RC3 is by using a DataSource and load your resource using the asset:// protocol. For application resources in particular, we've added a predefined ResourceDataSource.

Check the WPF WebControlSample available with the SDK, for an example of usage.

OTHER TIPS

I have found a solution, but this is not a feature of the Awesomium WebControl.

My Solution: I converted my image to string and then used the usual way of showing string images.

Dim myPNGImage As Image = My.Resources.MyImage
Dim strImage As String = Convert.ToBase64String(ImageToByteArray(myPNGImage))

WebControl1.LoadHTML("<img src='data:image/png;base64," & strImage & "' alt=''  />")

So while this works, I would like to know a better solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top