Instead of having the hassel of using a reporting tool, i decided to simply
use the TPrinter object and write directly to the canvas. All seems pretty
fine and dandy until i came to try and display the registration code. It is
the product of an public / private encryption system and the resultant data
/ ansistring is 172 characters long and is a solid block of text without any
spaces in it.
When I use this with DrawText or DrawTextEx it will not wrap the test so the
string goes of the end of the canvas / page. I assum this is because it
can't find any blank spaces between 'words'. I've tried all variations of
the flags but i get the same results...
Does anyone have any suggestions that i can use?
Many thanks in advance...
Mike C
> the resultant data / ansistring is 172 characters long and is a solid
> block of text without any spaces in it.
Does it have any hyphens in it?
> When I use this with DrawText or DrawTextEx it will not wrap the
> test so the string goes of the end of the canvas / page. I assum this
> is because it can't find any blank spaces between 'words'.
Spaces are not the only thing that can allow a string to be split.
I am assuming that you are specifying the DT_WORDBREAK flag, is that right?
What does the string actually look like?
Gambit
The encrypted block of text looks like this:
"U8m8Kr2hMPiT7Fs2XfDgtKVaID+XVSILmivZ3u/4gwjp6+ehDRo5NOUPSbIQWN7oUkdc0tMgKahe1dFr1joY1OtJ10wq7f87LLSVP0ZmhkG3hdrzKaMnZwxHozhGmHZLUgkoIVSpUb+hz/iGbvTYKUg7eljYjg0Ntbs72qoNFwk="
- the newsreader might wrap this... I'm passing it into the DLL as a char
pointer. I'm trying to write it out into a block with the canvas.
Any ideas?
"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:44b529fa$1...@newsgroups.borland.com...
> The encrypted block of text looks like this:
That is a base64-encoded string. There are no characters in base64 that
allow adequate word breaking. You will have to break up the string
manually, such as every xx number of characters. That is what email does,
for instance - each line is a fixed number of characters (usually around 76)
regardless of the encoding used. You could use 86 to break the line into of
2 lines of even length. Alternatively, you will likely have to query your
Canvas for the number of available pixels per line, and the number of pixels
per character, and then manually draw different portions of the string
accordingly on multiple lines.
Gambit
Just out of interest, do you know any good references on this sort of
thing - i want to create a more advanced print out i.e. watermarks and
possibly angled or rotated text but i can seem to find much other that
DrawText and TextOut...
As always, thanks alot for you help,
Mike C
"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:44b590c9$1...@newsgroups.borland.com...
> Just out of interest, do you know any good references on this sort
> of thing - i want to create a more advanced print out i.e. watermarks
> and possibly angled or rotated text but i can seem to find much other
> that DrawText and TextOut...
Use CreateFontIndirect() to use rotated fonts. Set the lfOrientation member
of the LOGFONT structure to the angle of rotation. You can then use
SelectObject() to apply the font to any Canvas prior to writing text on it.
Make sure that you are using a TrueType font, though.
Gambit