Is it possible to text wrap in a rectangle with the SDK?

Hi All,

 

I was wondering if there were any methods in the SDK that could text wrap a string in a boundary/rectangle? I am developing in c# and in the past I've used the Graphics object to measure the width of the string but this is has not always give accurate results and thought if anyone had come across a better solution?

 

I've tried the DrawTextRect method but this seems to only display text inside the specified rectangle and any text outside does not wrap and gets cut off.

 

 

Thanks in advanced

Stephen Troup
The solution I had was to

The solution I had was to completely ignore the graphics part of the sdk and use the vanilla .net routines.

A bit of digging with a .net decompiler and I found a way to hook into the sdk's internal graphics object after it's initialisation and bypass all the sdk's graphics routines in favour of my own I can then use the word wrap and formatting built into .net

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Alfred Teixeira
Hello Stephen,Which SDK(s)

Hello Stephen,

Which SDK(s) are you working with? What versions of the SDKs? What printer model and what version of firmware is installed in the printer? What version of the printer driver is installed if you are using the printer driver? What Operating System are you using?

Would it be possible for you to share your code that is causing the problem?

Best regards,

Al Teixeira

Zebra Global Services and Support

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Stephen Troup
Not having any issues as such

Not having any issues as such but this might help Adam with the issues with the zmotif graphics sdk

internal static System.Drawing.Graphics GetGraphicsObject(ref ZMTGraphics.ZMotifGraphics g)

        {

            System.Reflection.FieldInfo dynField = g.GetType().GetField("helper", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);

            object gg = dynField.GetValue(null);

            return (System.Drawing.Graphics)gg.GetType().GetField("graphics").GetValue(gg);

        }

After initialising the graphics object similar to below

g.InitGraphics(0, 0, (ZMTGraphics.ZMotifGraphics.ImageOrientationEnum)pageorientation, ZMTGraphics.ZMotifGraphics.RibbonTypeEnum.Color);

pass it to the routine using

System.Drawing.Graphics gfx = ZMotifZXP78Control.GetGraphicsObject(ref g);

and you'll get a .net graphics object with which you can play to your hearts content,

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments