user32.dll的DrawText是否有等效的方法? [英] Is there Equivalent method for DrawText of user32.dll?

查看:111
本文介绍了user32.dll的DrawText是否有等效的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经消耗了方法"DrawText()",从user32.dll到使用wordBreak的DrawText.我们还有其他方法可以用某些功能替换此方法.

DrawText(picImage.CreateGraphics().GetHdc().ToInt32(),新字符串(" c,Strings.Len(Gd1.get_TextMatrix(ind,gdHeading))* 2)& MSFlexGrid1.get_TextMatrix(wRow,mfgValue ),-1,rct,DT_WORDBREAK)

实现此功能的任何其他方法.我尝试根据空间分割文本.输出与旧应用程序不同.

I have consumed a method "DrawText()" from the user32.dll to DrawText with wordBreak.Do we have any other way to replace this method with some Functionality.

DrawText(picImage.CreateGraphics().GetHdc().ToInt32(), New String(" "c, Strings.Len(Gd1.get_TextMatrix(ind, gdHeading)) * 2) & MSFlexGrid1.get_TextMatrix(wRow, mfgValue), -1, rct, DT_WORDBREAK)

Any alternative way to do this functionality.I have tried using spliting the Text based on the Spaces.The output differs with the old application.

推荐答案

Graphics对象具有一个一堆在后台使用DrawText的DrawString方法.

顺便说一句:您发布的代码会泄漏资源,并最终导致机器崩溃.如果调用CreateGraphics,则必须在返回的对象上调用Dispose.您的代码不会执行此操作,最终将导致Windows在死之前做一些非常奇怪的事情.
The Graphics object has a bunch of DrawString methods that, under the covers, uses DrawText.

BTW: The code you posted leaks resources and will eventually crash the machine. If you call CreateGraphics you MUST call Dispose on the object you get back. Your code doesn''t do that and will eventually cause Windows to do some very weird things before it just dies.


这篇关于user32.dll的DrawText是否有等效的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆