如何打开位图文件并使用C ++在其上绘制字符串? [英] How to open a bitmap file and draw a string on it with C++?

查看:71
本文介绍了如何打开位图文件并使用C ++在其上绘制字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题:打开一个位图文件并用C ++语言在其上绘制一个字符串,你觉得这个吗?请帮我这样做,谢谢。

I have a problem: open a bitmap file and draw a string on it with C++ language, do you think about this? Please help me do this, thanks.

推荐答案

我想建议你从下面引用的CodeProject文章中找到它,但不知道你在问关于Windows。仍然不是100%肯定,但我看到你提到MFC,你的一些其他问题是针对Windows的。请参阅:

绘制线条,形状,或位图上的文字 [ ^ ]。



请查看我对您的问题的评论,下次请理解平台标签几乎总是重要的对于你的问题。



-SA
I wanted to advise you to find it out from the CodeProject article referenced below, but wasn''t sure you are asking about Windows. Still not 100% sure, but I saw that you mentioned MFC and some of your other questions was for Windows. Please see:
Drawing lines, shapes, or text on bitmaps[^].

Please see my comments to your question, and, next time, please understand that the platform tag is almost always important for your question.

—SA


如果你打算这样做Windows API(实际上是它的GDI组件),你需要知道处理内存DC'。这是一个漫长的话题,给你一个完整的答案。



这里有一些消息来源:

>>编程Windows Charles Petzold(见第14章)-http://www.amazon.com/Programming-Windows%C2%AE-Edition-Microsoft-Series/dp/157231995X/ref=sr_1_1?ie = UTF8&qid = 1358346269&sr = 8 -1&keywords =编程+窗口

>> Codeproject文章 - http://www.codeproject.com/Articles/224754/Guide-to-Win32-Memory-DC

>>搜索谷歌 - 有很多关于DC的事情
If you''re going to do it with the Windows API (really it''s GDI component), You need to know about handling memory DC''s. That''s quit a long topic give you a full answer.

Here''re some sources :
>> Programming Windows Charles Petzold (see chap. 14) -http://www.amazon.com/Programming-Windows%C2%AE-Edition-Microsoft-Series/dp/157231995X/ref=sr_1_1?ie=UTF8&qid=1358346269&sr=8-1&keywords=programming+windows
>> A Codeproject Article - http://www.codeproject.com/Articles/224754/Guide-to-Win32-Memory-DC
>> Search google - There''s plenty of things about DCs


亲爱的sergey

如果你使用visual c ++,下面的代码可以帮助你:



hi dear sergey
if you work with visual c++, below code helps you:

CImage i;
i.Load(_T("a.bmp"));
CDC cdc;
cdc.Attach(i.GetDC());
cdc.TextOut(_T("Hello world"),10,10);
cdc.Detach();
i.ReleaseDC();


这篇关于如何打开位图文件并使用C ++在其上绘制字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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