How to increase height limit of the TextBlock control in Windows Phone - windows-phone-7

I need to create a view with multiple TextBlocks populating thousands words. Unfortunately, when I set the Text of the TextBlock to contain a string longer than approx. 2000 characters the later part of the string is not displayed. The size of the TextBlock is still as if it contained all the characters, but the bottom of it is just blank.
Do you know what is the constraint that limit the length of the TextBlock? And how can I override it?

This is a limitation of the TextBox implementation on Windows Phone. If the area is larger thatn 2048 x 2048 it gets clipped.
This blog post has a workaround.

No UIElement can be greater than 2048 pixels in either dimension, however, if you exceed this limit, the space for the larger element is still reserved.
As a workaround, see this blog post which has a simple technique for splitting text into multiple TextBlocks.

Related

ZPL command how to reduce a barcode's size of the same ratio?

I would like to reduce my barcode's size but still be the same ratio like picture below.
From
Original Size
To be
Reduced Size
Here is my ZPL code.
^XA
^FO50,20
^BY2,2,20
^BCN,,N,N,N,D
^FDZWW011601512345^FS
^XZ
Please help me how do I deal with it?
Thank you.
This website is great for testing against: http://labelary.com/viewer.html.
Assuming you don't want the position to move it should just be changing
^BY2,2,20
to
^BY1,1,10
The API Reference guide can be found https://www.zebra.com/content/dam/zebra/manuals/en-us/software/zpl-zbi2-pm-en.pdf
Don't forget to take into consideration the print density, i.e. at 152 DPI you probably want something like
^FO150,20
^BY1,1,10
But at 600 DPI
^FO550,80
^BY4,1,40
EAN-13 Text Modifications
If you are using the the inbuilt EAN-13 text function i.e. ^BEN,40,Y,N you can't modify the text. It is to a standard. You can however add your own text e.g.
^XA
^FO100,20
^BEN,40,N,N
^FD011601512345^FS
^CF0,48
^FO90,80^FD011601512345^FS
^XZ
^BEN,40,N,N The first N tells the printer to not generate the number underneath.
^CF0,48 Is the select font function of the printer, its first parameter is a default printer font (can be found in the Standard Printer Fonts section of the link above). The second parameter is the font height. If needed there can be a 3rd parameter which alters the font width, though isn't needed.
^FO90,80^FD011601512345^FS Sets the field origin of the string starting at the location defined by ^FO. ^FDXXXXXXXX^FS draws the string.

DPI awareness: could I be told when I need to recalculate my text height so I don't have to do it all the time? And SM_CYSMICON/checkbox heights too?

A frequent operation in my Windows Table control, which I am reworking and moving into a DLL, is to get the height of a row. This is the maximum of
the height of text in the current font, in pixels
the current small icon height, in pixels (GetSystemMetrics(SM_CYSMICON))
the height of checkboxes, in pixels (determined on a WM_THEMECHANGED, when checkbox information is recalculated)
Calculating the text height, as far as I know, requires getting a DC, selecting the font in (and getting the SYSTEM_FONT if that's NULL), getting the text metrics, selecting the font out, and releasing the DC, all of which can error out/fail/etc. This means that virtually every function in my control can fail.
I can avoid this by storing the text height somewhere else, only calculating it when it changes. I know that text height is a property related to the DPI of the DC that GetDC(hwnd) returns. I would like my control to be DPI-agnostic because DPI awareness is per-process, not per-DLL/per-window.
At the same time, knowing when GetSystemMetrics(SM_CYSMICON) changes would also be useful.
So my questions are simple:
Is there a message that I can look for that will tell me that my DPI has changed and that I need to recalculate my text height?
Is there a message that will tell me that SM_CYSMICON has changed and that I need to recalculate everything? Is it the same one? (I know there is no reliable way to detect a GetSystemMetrics() failure (since 0 is a valid return and it does not set the last error code), so I am assuming it cannot fail with a valid parameter and am simply calling it each time I need to calculate the row height; this is just so I can queue a redraw when the value does change.) Would it also work for SM_CXSMICON?
In addition, looking back at my code, GetThemePartSize() takes a DC as well; do theme items like checkbox images scale with DPI? And if so, what messages do I look for in that case? The same one?
Alternative: is there a non-failing way to get the text height that I don't know about, given only a HWND and HFONT?
I will be happy to take a solution that was introduced in either Windows XP or Windows Vista; if there's a solution that was introduced in a newer version of Windows, then knowing about it could also be beneficial.
Thanks.

Additional Data being appended to CKEditor String

When i type 1960 characters in CKEditor and submit the form, my controller is getting around 2000 characters. I have checked through the data but still cant find out the exact reason why it is going like that
Length of data in UI : 1978
Length of data in Controller : 1991
so, additional 13 characters are added.
The data i am sending in UI is as follows --------------------------------------
Some older driver versions allowed you to select the “letter” size and adjust the margins to define the ticket size. This feature is still available in the new drivers to support old installations. When selecting a new font, Windows will default to the previous font size. This size will usually be incorrect. You must re-assign a valid font size to guarantee the proper font representation on your screen. "Tall" font in Word Pad does not display properly on the screen. Driver Use – Word Only (PCL and FGL) Before using Word, you must select the “use printer metrics to layout document” box in tools/options/compatibility. All of the previous “driver use” guidelines apply to Word. Word also provides you with the unique ability to define a custom page size within the application itself. We strongly recommend against the use of this feature. However, the following description will explain the use and limitations of this feature. While Word allows you to manipulate the page size in both portrait and landscape modes, the data sent to the printer only functions properly in portrait mode. You cannot print in landscape mode with a Word defined custom page size. In portrait mode, you can manually set the height for any ticket length up to 11 inches. For ticket lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section. lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section. lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section. lengths greater than **
The data im receiving in controller is as follows --------------------------------------
Some older driver versions allowed you to select the “letter” size and adjust the margins to define the ticket size. This feature is still available in the new drivers to support old installations.
When selecting a new font, Windows will default to the previous font size. This size will usually be incorrect. You must re-assign a valid font size to guarantee the proper font representation on your screen. "Tall" font in Word Pad does not display properly on the screen.
Driver Use – Word Only (PCL and FGL)
Before using Word, you must select the “use printer metrics to layout document” box in tools/options/compatibility. All of the previous “driver use” guidelines apply to Word. Word also provides you with the unique ability to define a custom page size within the application itself. We strongly recommend against the use of this feature. However, the following description will explain the use and limitations of this feature.
While Word allows you to manipulate the page size in both portrait and landscape modes, the data sent to the printer only functions properly in portrait mode. You cannot print in landscape mode with a Word defined custom page size.
In portrait mode, you can manually set the height for any ticket length up to 11 inches. For ticket lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section.
lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section.
lengths greater than 11 inches, you will need to add your own page size as described above in the “all applications” section.
lengths greater than
I depends on the way you are requesting the output, but this can be spaces or this could also be some \n\r tags for all the that you have inserted.
Did you try already to see the differences in short texts, to find you what it is exactly?
I think it are some \n\r tags, you should see these tags when you request the data in you code.. If not i'm sure it are spaces.

SSRS Lable Printing

I have a SSRS RDL that is formated to fit on a three column lable sheet. When exported to PDF the 2nd column is not populated and on the next page the 2nd column is the only column populated. This continues to happen for as much data as I have. Has anyone had any problems with this or might have an idea on where the problem might be?
These kinds of quirks are usually related to the margins. Make sure that the actual label area does not exceed the page size, accounting for the margins. Also, printer drivers can cause a similar issue because of content-to-page-size issues, where the report shows correct on-screen but when printing, shifts content to a new page.
This is because of page setup properties. For example if a page is set to letter size(8.5in X 11in) and left and right margins to 1 inch. then you have adjust you report body size to 6.5 inch or below, if it exceeds above 6.5 inch, then leads to split data to other pages when exported to PDF.

How do I adjust the font size of a tetxblock control depending on the length of the text string that it contains?

I have a textblock and I pull items out of a database and I want to make the text fit on one line. How do I programmatically adjust the font size such that the entire line fits on the phone screen?
Thank you.
I ended up using what Jared Bienz linked to.

Resources