HtmlPanel - rich text on the device

Byak@

Active Member
Licensed User
I can on my device but note that it doesn't work in App_Start on the device because the Form isn't drawn then. It only gets drawn after App_Start ends. On the desktop the undrawn ScrollBars seem to keep the Visible setting if set False in App_Start but on the device they appear to default to Visible when first drawn.
oops)

In what way? It seems to be correct in the demo.
i'm find problem.real Max value for HScrollValue is HScrollMax-PictureBox.Height, Yes?
 

agraham

Expert
Licensed User
Longtime User
From the help. HScroll is similar.
VScrollMax : Int32 : Gets the maximum value of the vertical scrollbar which is the height of the PictureBox.

VScrollValue : Int32 [I/O] : Gets or sets the position of the vertical scrollbar. The minimum to use is 0 and the maximum is VScrollMax - VScrollLargeChange otherwise the underlying Panel will become visible.
 

Byak@

Active Member
Licensed User
oh,Andrew,BIG THANKS!
 

berndgoedecke

Active Member
Licensed User
Longtime User
<div Tag and CSS2.1 features

Hello AGraham,
during my search for a SQLite-report solution I've checked the HTML posibilities in the WebBrowser and HTMLPanel Liraries. Also I loaded down the new Opera Mobile browser. This Browser supports CSS2.1 as well as the anounced Microsoft Browser for the next Mobile Windows version.
Particular the <div tag in combination with CSS 2.1 are powerfull tools to get nice formated HTML pages. CSS 2.1 provided also printer optimized pages.
If there is a way to integrate this features in HTML panel, it would be an alternative to postscript or pdf and in conjunction with B4P reporting would be possible also.

best regards

Bernd Goedecke
 

Byak@

Active Member
Licensed User
i'm think it is so very hard... HTMPpanel it is a parser and renderer_to_bitmap and working with css...i'm think it is a very big work...
 

Byak@

Active Member
Licensed User
Andrew, what about a zoom function?i think it will take effect only after redraw.
 

agraham

Expert
Licensed User
Longtime User
Andrew, what about a zoom function?
The support for AutoScale made this easy to try but it doesn't work very well. This is because, being pixel based, the drawing is done with integer values and the rounding of scaled values makes it look wrong. I don't think it is worth doing.
 

Byak@

Active Member
Licensed User
why you can't use zoom function (from system.drawing) for rendering?
 

Byak@

Active Member
Licensed User
i'm think a 'zoom' method from your ImageLibEx is a standart .Net's method :-[

Andrew i have a problem=( In my PPC i have a 70mb of free memory space BUT when i start rennder this document i have a OutOfMemory exeption!why?
 

agraham

Expert
Licensed User
Longtime User
i have a OutOfMemory exeption!why?
I think it must be a device limitation of some sort. I have taken your file and renamed it "test.txt" and rendered it using my demo program from the library archive.

My Axim X30 can both render your data and my demo test file with no problems both in the IDE and when optimised compiled. I have noticed before that although an old device running WM2003SE it can happliy run Basic4ppc applications that give Out of Memory exceptions on my other two devices which use WM6.x.

My iPAQ 214 renders both your data and my demo test file with no problems in the IDE but when optimised compiled throws an Out of Memory exception on your data but renders my test file with no problems.

My HTC Diamond freezes, needing a reboot, when I run both your data and my demo test file in the IDE and throws an Out of Memory exception when I run them optimised compiled. It works fine if I shorten my test file, I didn't try shortening yours as it lacks line breaks so I couldn't see the structure of it.

I am afraid that it looks like a different devices have different limitations on the amount of memory, or more likely resources, that are available. You can only try shortening your file. HtmlPanel probably uses a lot more memory/resources than you might think as it uses the .NET XMLDocument class to parse the HTML which builds an in memory tree representation of the XML nodes of the file which HtmlPanel then uses to build a copy of that document tree but using nodes that can render their content.
 

agraham

Expert
Licensed User
Longtime User
As an addition to the above post where I missed the blindingly obvious:sign0161:

The bitmap produced rendering your data is about 7Mb on a QVGA screen. You can see this in my demo app by tapping the bottom right of the rendered image. The image is about 220 x 11000 pixels which occupies 220 x 11000 x 3 bytes = 7.26Mb. On a VGA screen if AutoScaled compiled or when in the device IDE it looks identical but actually the bitmap is four times bigger, that is 28Mb! This quadrupling of bitmap size explains why my Axim X30 is happy where the Diamond and iPAQ are not and is probably the reason for the Out of Memory exception.

You don't have to understand what follows but an interesting fact I have discovered about .NET bitmaps is that where the memory for them is allocated differs according to how they are created. On the device each application only has access to 32Mb of memory. If they are created using a stream (filename) they are allocated within this 32Mb and the CF garbage collector knows about them and can reclaim their memory when necessary. If a bitmap is created by specifying a width and height is is created outside this 32Mb space in unmanaged memory space and the garbage collector only knows about the small amount of memory used in the 32Mb area used to access the large amount of data outside. Calling Dispose on such a bitmap makes the garbage collector free this unmanaged memory. The third way creating a bitmap from another bitmap also allocates space outside the 32Mb area and copies the source bitmap to it.

HtmlPanel creates its' bitmap using width and height and so the bitmap is an external one. I found empirically that I had to Dispose any existing rendered bitmap before rendering a new one and this explains why.
 
Last edited:

Aspire89

Member
Licensed User
The problem.
I'm trying to open the file:
HTML:
<html>
<table width="240">
    <tr>
        <td>
            <img scr="cray1tn.gif"/>
        </td>
        <td>
            Hello World Hello World Hello World Hello World 
        </td>
    </tr>
    <tr>
        <td>
            <img scr="cray1tn.gif"/>
        </td>
        <td>
            Hello World Hello World Hello World Hello World Hello World Hello World 
        </td>
    </tr>
</table>
</html>
and get
attachment.php

Please help fix it.
 

Attachments

  • htmlpanel.JPG
    htmlpanel.JPG
    10.5 KB · Views: 73

Aspire89

Member
Licensed User
agraham,
Thank you, and this in the future not planned to implement it?

Ariel_Z,
Twitter client client write, the image is the avatar, and the text of this tweet.
 
Top