To compile, add before headers :
#define GDIPVER 0x0110
All recent OS (>= Vista) have GDIPlus 1.1
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Still on my learning curve for using metafiles, I'm now drawing one with GDI+, using the GDI+ Metafile class.
But I want antialiasing, and for that, I believe, I have to call (one of the overloads of) Metafile::ConvertToEmfPlus( ).
These only exist in a recent version of GDI+ . The header file for class Metafile goes:
#if (GDIPVER >= 0x0110)
Status ConvertToEmfPlus(
IN const Graphics* refGraphics,
IN OUT INT* conversionFailureFlag = NULL,
IN EmfType emfType = EmfTypeEmfPlusOnly,
IN const WCHAR* description = NULL
);
...
Now the version of GDI+ I am using, apparently has GDIPVER < 0x0110, so this method is not available to me.
I suspect this is just the SDK, as I understand that GDI+ is part of a standard Windows installation these days, and I keep up-to-date with my Windows 10 updates. (And I'm using Visual Studio 2019, which I also keep updated).
So two questions if I may:
The second question is because my application will be used by some people under Windows 7, and their built-in GDI+ may well, I suspect, be the earlier version.
Dave
To compile, add before headers :
#define GDIPVER 0x0110
All recent OS (>= Vista) have GDIPlus 1.1
One again, great - thanks. [ Rhetorically: did GDI+ 1.1 really come in in Vista - time goes by so quickly these days! ]
I had to put the definition at the start of my stdafx.h file, as anywhere later and it had already defined GDIPVER though I haven't found where!
I don't know if there's any protocol about answering perfect answers here, but I feel it may help others reading this, so here goes. I am trying to draw dialogue buttons with EMF images to facilitate high DPI. The problem is that at standard DPI, the vector graphics on small buttons look horrible. As a test case (at standard 96dpi) I've created a 'help' image. The code which draws it is:
void CEmfButton::emfGrfImage( HDC hDC, const RECT &rct, HENHMETAFILE hEmf ) const
{
Metafile mfile( hEmf, FALSE );
Graphics Gr( hDC );
Gr.SetSmoothingMode( SmoothingModeAntiAlias );
#if( GDIPVER >= 0x0110 )
{
BOOL bSuccess = FALSE;
EmfType emftype = EmfTypeEmfPlusOnly;
CStringW sDescription( L"" );
Status sta = mfile.ConvertToEmfPlus( &Gr, &bSuccess, emftype, (LPCWSTR)sDescription );
}
#endif
int x = rct.left;
int y = rct.top;
int w = rct.right - rct.left + 1;
int h = rct.bottom - rct.top + 1;
Rect rect( x, y, w, h );
Gr.DrawImage( &mfile, rect );
return;
}
where my CEmfButton is derived from CButton and this is called by the DrawItem() method of the owner-draw button.
Without the #if section the button is drawn without antialiasing:
With the #if section it is antialaised:
And I am, as they say, a happy bunny!
Dave