SUMMARY
Unicode text, such as Chinese, is only partially shown on rows which span columns. I discovered this bug on Chinese Simplified version of Windows 2000. (Bug does not occur on columns which don't span columns.)
CAUSE
DrawText() API is being used to draw this text, which is fine, but VB's Len() function doesn't return the expected number of bytes. Len() function returns the number of chars, but API function needs the number of bytes. To make things more confusing, it accepts a multi-byte char string, which means 1 byte for ASCII chars and 2 bytes for unicode chars.
For example, if the string is this "AB**" (pretend the asterisks are chinese chars), then the total length would be 6. A=1, B=1,*=2, *=2. Not sure how this is possible, but it seems to be the case.
SOLUTION
I've found a solution on MSDN. I had to create my own function to determine the length of the string for this API function. I added function LenMbcs() to file mAPIAndCallbacks.
|
Resolved in SGrid 2.0. The new version uses a length parameter of -1, rather than explicitly providing a length to DrawText, which enables Windows to calculate the correct length of the string. It also uses DrawTextW (Unicode version) under NT/2000/XP/2003. |