Solved

Adding text on to a bitmap handle.

Posted on 1998-11-16
1
162 Views
Last Modified: 2013-11-20
I have loaded a bitmap and have the bitmap handle.Now I have to add some text on to the bitmap and save it. How do I do?
0
Comment
Question by:rharsha
1 Comment
 
LVL 12

Accepted Solution

by:
migel earned 20 total points
Comment Utility
Hi!
To add text to the bitmap you must select bitmap into Device Context and simple draw text by API function.
for example:

// Draw text into bitmap at the pt.x, pt.y  position
BOOL DrawTextIntoBitmap(HBITMAP hbm, LPSTR lpszText, HFONT hFont, POINT pt)
{
HDC hdc = CreateCompatibleDC(NULL); // compatible with system screen DC
if (!hdc)
    return FALSE;
HBITMAP hbmOld = (HBITMAP) SelectObject(hdc, hbm);
HFONT hFontOld = (HFONT) SelectObject(hdc, hFont);

TextOut(hdc, pt. x, pt.y,  lpszText, lstrlen(lpszText));
SelectObject(hdc, hFontOld);
SelectObject(hdc, hbmOld);
DeleteDC(hdc);
return TRUE;
}
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now