Click here to Skip to main content
Sign Up to vote bad
good
See more: 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.
Posted 15-Jan-13 13:39pm

Comments
Sergey Alexandrovich Kryukov - 15-Jan-13 19:52pm
Your platform? —SA
Andrewpeter - 16-Jan-13 8:44am
Thanks SA for your question, I code "Console" platform. Hope you help me.
Sergey Alexandrovich Kryukov - 16-Jan-13 13:15pm
Sorry, "Console" is not a platform. And, with your problem, it does not matter at all if you use console or not. Do you mean Windows, Linux, something else? —SA
Andrewpeter - 16-Jan-13 22:28pm
My platform is Windows. Thanks.

3 solutions

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
  Permalink  
Comments
Andrewpeter - 16-Jan-13 22:27pm
Yes sir, it's great. Thank you very much.
Sergey Alexandrovich Kryukov - 16-Jan-13 22:43pm
My pleasure. Good luck, call again, —SA
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
  Permalink  
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();
  Permalink  
Comments
Andrewpeter - 16-Jan-13 8:45am
Thanks, your code is used for MFC?
Sergey Alexandrovich Kryukov - 16-Jan-13 22:43pm
Shared between ATL and MFC: http://msdn.microsoft.com/en-us/library/bwea7by5%28v=vs.110%29.aspx —SA
Sergey Alexandrovich Kryukov - 16-Jan-13 22:41pm
Who do you call Sergey? —SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 6,889
1 Prasad_Kulkarni 3,671
2 OriginalGriff 3,359
3 _Amy 3,312
4 CPallini 2,925


Advertise | Privacy | Mobile
Web04 | 2.6.130617.1 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid