Problem displaying images

0
0

Hi,

When I display an image in a modal dialog, it does not display correctly the first try (looks like just the top 5% renders, but nothing else does), but if you close the dialog and then re-display it, the image displays correctly.

A simple demo is attached.  I have extracted the classes used from a large application, hence some unused overhead functionality in the demo.

Thanks for your help!

Neil.

  • You must to post comments
0
0

Thanks Luca,

Changing to a PictureBox is the way to go.  I did look at that, but couldn’t quite connect the dots to make it work.

The app uploads “documents” (pdfs or images) elsewhere … they are physically stored in the /Resources/UserData/ subfolder, with a database entry record.  So the viewer is supplied with a string eg “Resources/UserData/test1.jpg” to view.  The image does not exist at design time (in properties or a resx).

Could you show how to wire the PictureBox to dynamically display the string?

Thanks,
Neil

  • You must to post comments
0
0

The sample app is setting <img src… width=100% height=100%/>

The width and height set to a percentage in html is the percentage of the container but the html you are setting is just the image. Set an actual size for the image, or set a container element with a size. It’s also a lot better if you use the PictureBox control instead of the HtmlPanel (which is scrollable) to show an image.

  • Luca (ITG)
    Forgot to add that the calls to htmlBox1.Refresh() and Update() don’t do anything. The control is already marked to be updated automatically. The same for pdfViewer1.Update() – doesn’t do anything since it’s already marked for update.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.