Click here to Skip to main content
15,911,039 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: using static library for C code in Visual studio 2005 Pin
Chris Losinger12-Sep-12 2:15
professionalChris Losinger12-Sep-12 2:15 
GeneralRe: using static library for C code in Visual studio 2005 Pin
Malli_S12-Sep-12 2:17
Malli_S12-Sep-12 2:17 
GeneralRe: using static library for C code in Visual studio 2005 Pin
Chris Losinger12-Sep-12 2:19
professionalChris Losinger12-Sep-12 2:19 
GeneralRe: using static library for C code in Visual studio 2005 Pin
Malli_S12-Sep-12 2:23
Malli_S12-Sep-12 2:23 
GeneralRe: using static library for C code in Visual studio 2005 Pin
sunny_vc12-Sep-12 2:42
sunny_vc12-Sep-12 2:42 
AnswerRe: using static library for C code in Visual studio 2005 Pin
jschell12-Sep-12 8:04
jschell12-Sep-12 8:04 
GeneralRe: using static library for C code in Visual studio 2005 Pin
Malli_S12-Sep-12 20:01
Malli_S12-Sep-12 20:01 
GeneralRe: using static library for C code in Visual studio 2005 Pin
sunny_vc12-Sep-12 23:55
sunny_vc12-Sep-12 23:55 
GeneralRe: using static library for C code in Visual studio 2005 Pin
jschell14-Sep-12 8:38
jschell14-Sep-12 8:38 
QuestionHow to lock a file when it is in use? Pin
tagopi12-Sep-12 0:46
tagopi12-Sep-12 0:46 
AnswerRe: How to lock a file when it is in use? Pin
Malli_S12-Sep-12 1:56
Malli_S12-Sep-12 1:56 
AnswerRe: How to lock a file when it is in use? Pin
Software_Developer13-Sep-12 5:43
Software_Developer13-Sep-12 5:43 
QuestionGetting List of Specific Installed Programs Pin
AmbiguousName11-Sep-12 6:02
AmbiguousName11-Sep-12 6:02 
AnswerRe: Getting List of Specific Installed Programs Pin
Michael_Lu11-Sep-12 8:21
Michael_Lu11-Sep-12 8:21 
QuestionCan't select HBRUSH into device context Pin
Alan Balkany11-Sep-12 5:38
Alan Balkany11-Sep-12 5:38 
AnswerRe: Can't select HBRUSH into device context Pin
Jochen Arndt11-Sep-12 6:04
professionalJochen Arndt11-Sep-12 6:04 
GeneralRe: Can't select HBRUSH into device context Pin
Alan Balkany11-Sep-12 6:10
Alan Balkany11-Sep-12 6:10 
GeneralRe: Can't select HBRUSH into device context Pin
Jochen Arndt11-Sep-12 7:07
professionalJochen Arndt11-Sep-12 7:07 
GeneralRe: Can't select HBRUSH into device context Pin
Alan Balkany11-Sep-12 7:08
Alan Balkany11-Sep-12 7:08 
AnswerRe: Can't select HBRUSH into device context Pin
enhzflep11-Sep-12 10:20
enhzflep11-Sep-12 10:20 
Yeah, it shouldn't be a problem to do what you're asking for.
You need to make use of _both_ TextOut and Paths.

Basically, the process goes like this (sorry code is in a PDF ebook that prevents copy and paste)

1. Create your font
2. Select it into your hdc
3. Call BeginPath(hdc)
4. Call TextOut
5. Call EndPath
6. Use StrokePath for the outline, FillPath for the interior.
7. Select the old font back into the hdc
8. delete your font from #1

Ah! found a CHM version of the same book. Here's the code given there:
(I'll leave it as, unedited, for completeness)

void PaintRoutine (HWND hwnd, HDC hdc, int cxArea, int cyArea)
{
     static TCHAR szString [] = TEXT ("Filling") ;
     HFONT        hFont ;
     SIZE         size ;

     hFont = EzCreateFont (hdc, TEXT ("Times New Roman"), 1440, 0, 0, TRUE) ;

     SelectObject (hdc, hFont) ;
     SetBkMode (hdc, TRANSPARENT) ;

     GetTextExtentPoint32 (hdc, szString, lstrlen (szString), &size) ;

     BeginPath (hdc) ;
     TextOut (hdc, (cxArea - size.cx) / 2, (cyArea - size.cy) / 2,
                    szString, lstrlen (szString)) ;
     EndPath (hdc) ;

     SelectObject (hdc, CreateHatchBrush (HS_DIAGCROSS, RGB (255, 0, 0))) ;
     SetBkColor (hdc, RGB (0, 0, 255)) ;
     SetBkMode (hdc, OPAQUE) ;

     StrokeAndFillPath (hdc) ;

     DeleteObject (SelectObject (hdc, GetStockObject (WHITE_BRUSH))) ;
     SelectObject (hdc, GetStockObject (SYSTEM_FONT)) ;
     DeleteObject (hFont) ;
}

Make it work. Then do it better - Andrei Straut

GeneralRe: Can't select HBRUSH into device context Pin
Alan Balkany11-Sep-12 10:23
Alan Balkany11-Sep-12 10:23 
GeneralRe: Can't select HBRUSH into device context Pin
enhzflep11-Sep-12 10:30
enhzflep11-Sep-12 10:30 
GeneralRe: Can't select HBRUSH into device context Pin
Alan Balkany13-Sep-12 10:47
Alan Balkany13-Sep-12 10:47 
QuestionFile download help Pin
Sunil P V10-Sep-12 1:04
Sunil P V10-Sep-12 1:04 
QuestionRe: File download help Pin
David Crow10-Sep-12 2:38
David Crow10-Sep-12 2:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.