The code you wrote works ben. There just needs to be some conversion for txt. Using Stringwidth(txt) somewhere inside of CalculateTextW(txt) should do it. Than you would have both the x and textw in the same terms, pixels. This post is from -- http://socoder.net/index.php?topic=2627