Click here to Skip to main content
15,912,204 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: help required Pin
22491712-Nov-04 0:02
22491712-Nov-04 0:02 
GeneralRe: help required Pin
David Crow12-Nov-04 4:07
David Crow12-Nov-04 4:07 
Generalhelp required Pin
adnan pathan11-Nov-04 18:53
adnan pathan11-Nov-04 18:53 
GeneralExecuting Batch file Pin
Katamneni11-Nov-04 18:51
Katamneni11-Nov-04 18:51 
GeneralRe: Executing Batch file Pin
22491711-Nov-04 23:59
22491711-Nov-04 23:59 
GeneralExecuting Batch file Pin
Katamneni11-Nov-04 18:47
Katamneni11-Nov-04 18:47 
GeneralProgress bar Pin
Logan from Singapore11-Nov-04 18:20
Logan from Singapore11-Nov-04 18:20 
GeneralRe: Progress bar Pin
bryce11-Nov-04 18:24
bryce11-Nov-04 18:24 
GeneralRe: Progress bar Pin
Logan from Singapore11-Nov-04 21:12
Logan from Singapore11-Nov-04 21:12 
Generalconverting to mouse coordinates Pin
Member 52815511-Nov-04 18:02
Member 52815511-Nov-04 18:02 
GeneralRe: converting to mouse coordinates Pin
bryce11-Nov-04 18:29
bryce11-Nov-04 18:29 
GeneralRe: converting to mouse coordinates Pin
Member 52815511-Nov-04 20:12
Member 52815511-Nov-04 20:12 
GeneralMemory Address Query Pin
Member 89184611-Nov-04 16:24
Member 89184611-Nov-04 16:24 
GeneralRe: Memory Address Query Pin
bryce11-Nov-04 16:47
bryce11-Nov-04 16:47 
GeneralRe: Memory Address Query Pin
Member 89184611-Nov-04 16:54
Member 89184611-Nov-04 16:54 
GeneralRe: Memory Address Query Pin
bryce11-Nov-04 18:08
bryce11-Nov-04 18:08 
GeneralRe: Memory Address Query Pin
Member 89184611-Nov-04 18:22
Member 89184611-Nov-04 18:22 
GeneralGUI Builder Pin
Anonymous11-Nov-04 16:21
Anonymous11-Nov-04 16:21 
GeneralRe: GUI Builder Pin
alex.barylski11-Nov-04 20:56
alex.barylski11-Nov-04 20:56 
Questionhow to simulate the action of key of power Pin
yingkou11-Nov-04 14:21
yingkou11-Nov-04 14:21 
AnswerRe: how to simulate the action of key of power Pin
Christian Graus11-Nov-04 15:02
protectorChristian Graus11-Nov-04 15:02 
GeneralRe: how to simulate the action of key of power Pin
yingkou12-Nov-04 13:22
yingkou12-Nov-04 13:22 
GeneralRe: how to simulate the action of key of power Pin
Christian Graus12-Nov-04 22:23
protectorChristian Graus12-Nov-04 22:23 
GeneralIs an adapter Wireless or Not Pin
Anonymous11-Nov-04 12:11
Anonymous11-Nov-04 12:11 
GeneralGDI+ GraphicsPath AddString Pin
rob_toutant11-Nov-04 10:52
rob_toutant11-Nov-04 10:52 
Has anyone else found that adding a String to a GraphicsPath, GraphicsPath.AddString, produces a smaller font size than using Graphics.AddString -

there is nothing in my code which is adding any global transformations to the path.

In the microsoft documentation it shows that the font size for Using GraphicsPath.AddString is in World Units ??? anybody have a suggestion to make the font size correct ?

Mad | :mad:
<br />
//code which produces the correct font display size<br />
<br />
void DrawTextPathRect(Graphics *g,float x, float y,float width, float height,LPCSTR str, LPCSTR strFont, float size, int align, int style,COLORREF cr, int alpha)<br />
{<br />
        CString s(_T(str));<br />
        CString sFont(_T(strFont));<br />
        Font font(sFont.AllocSysString(), size);<br />
<br />
        FontFamily ff<br />
<br />
        font.GetFamily(&ff);<br />
<br />
        StringFormat sf;<br />
        sf.SetAlignment((StringAlignment) (align&3));<br />
        RectF p(x, y,width,height);<br />
<br />
        SolidBrush crBrush(Color(alpha, GetRValue(cr), GetGValue(cr), GetBValue(cr)));<br />
<br />
        g->SetCompositingMode( CompositingModeSourceOver );<br />
        g->SetSmoothingMode( SmoothingModeAntiAlias );<br />
        g->SetCompositingQuality( CompositingQualityAssumeLinear );<br />
        g->SetTextRenderingHint( TextRenderingHintAntiAlias );<br />
<br />
     // Draw string.<br />
   g->DrawString(<br />
   s.AllocSysString(),<br />
   s.GetLength(),<br />
   &font,<br />
   p,<br />
   &sf,<br />
   &crBrush);<br />
<br />
<br />
}<br />
<br />
//this produces the font which does not match the above <br />
// it is smaller by about 20 percent<br />
<br />
GraphicsPath *BuildTextPathRect(float x, float y,float width, float height,LPCSTR str, LPCSTR strFont, float size, int align, int style)<br />
{<br />
        CString s(_T(str));<br />
        CString sFont(_T(strFont));<br />
        Font font(sFont.AllocSysString(), size);<br />
<br />
        FontFamily ff;<br />
        font.GetFamily(&ff);<br />
<br />
        StringFormat sf;//Set=(StringFormat) align;<br />
        sf.SetAlignment((StringAlignment) align);<br />
        RectF p(x, y,width,height);<br />
        GraphicsPath *path = new GraphicsPath();<br />
<br />
        REAL enSize = font.GetSize();<br />
        path->AddString(s.AllocSysString(), s.GetLength(), &ff, (FontStyle) style, enSize, p, & sf);<br />
<br />
        return path;<br />
<br />
}<br />


robert

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.