简体   繁体   English

C ++在窗口上输出文本

[英]C++ Outputting text on a window

Simple question, is drawing text using functions like TextOut or DrawText better then creating a static control, performance wise? 一个简单的问题,在性能上,使用TextOut或DrawText之类的函数绘制文本是否比创建静态控件更好?

And which has better performance TextOut or DrawText? 哪个具有更好的性能TextOut或DrawText?

Second question first: DrawText calls TextOut , so if you don't need the formatting capabilities of DrawText , you can go straight to TextOut . 首先要回答的第二个问题: DrawText调用TextOut ,因此,如果不需要DrawText的格式化功能,则可以直接转到TextOut

If raw performance is all you care about, then drawing directly will be faster. 如果您只关心原始性能,则直接绘制会更快。 However, raw performance should not be your sole concern. 但是,原始性能不是您唯一关心的问题。 It is also more work and does not support accessibility (which means you have to write additional code to support IAccessible ). 这也需要更多工作,并且不支持可访问性(这意味着您必须编写其他代码来支持IAccessible )。

DrawText looks more powerful and flexible, possibly it makes more work. DrawText看起来更强大,更灵活,可能会完成更多工作。 Regarding HDC drawing vs. static control: they are used for different purposes. 关于HDC绘图与静态控制:它们用于不同的目的。 For example, it is better to use static control in a dialog. 例如,最好在对话框中使用静态控件。 But if you want to draw some text in a graph - dynamic text is much better. 但是,如果要在图形中绘制一些文本,那么动态文本会更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM