Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Drawing Text when it contains non-printable characters

$
0
0

Hi,

I am working on a terminal emulator program which echos what it receives from the serial port. Some lines contains a combination of non-printable and printable characters. I am using fixed pitch fonts like "Courier" and "Courier New" which are common and some older one's CP437 which are not common and they come from the old DOS days where the lower ascii control characters show up as diamond, club, heart, square smiley faces, etc.
Using "Courier", when the line does not include a non-alphanumeric character, the length of the line is normal (most lines do not include these characters and they line up on the left and right). When the line includes both printable (a-z, A-Z,0-9) and "non-printable characters" (!,+,HEX(04),HEX(05), etc) , the length of the line is longer.  I have tried using both ExtTextOut and DrawText, but both end up acting the same way. How can i make the lines to come out to the same width? Here is the code excerpt for drawing the line:


//cdcMemDC.ExtTextOut(nHorzPos, nVertPos, ETO_OPAQUE | ETO_CLIPPED, &rect, strText, strText.GetLength(), NULL);
cdcMemDC.DrawText(strText, strText.GetLength(), &rect, DT_EDITCONTROL);

Thanks in advance for your response!
ilikecoding


ilikecoding


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>