Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » PrintPrview And Gdiplus question Collapse All
Subject Author Date
tera tera Sep 15, 2009 - 1:50 AM

Hello.


I am troubled.

When I draw a screen, I use GDI+.


In GDI+, I perform PrintPrview.

However, it is displayed incorrectly when I make a metafile in CMetaFileDC and do PrintPreview.


BOOL CNxkCViewPPW :: OnPreparePrinting( CPrintInfo * pInfo ) {   :   :   :   : CMetaFileDC dcEMF; if( ! dcEMF.CreateEnhanced( pDC , ( ! strMetafileName.IsEmpty() ) ? LPCTSTR(strMetafileName) : NULL , rcEmfExtent, NULL ) ) { ASSERT( FALSE ); throw 0; }

 



 


There is a MetaFile command in GdiPlus.

Will it be displayed definitely if I use Class of GdiPlust-MeFile?


Gdiplus http://msdn.microsoft.com/en-us/library/ms534077(VS.85).aspx

/**************************************************************************\ * Copyright (c) 1998-2001, Microsoft Corp.  All Rights Reserved. * Module Name: *   GdiplusMetafile.h * Abstract: *   GDI+ Metafile class \**************************************************************************/

#ifndef _GDIPLUSMETAFILE_H #define _GDIPLUSMETAFILE_H

class Metafile : public Image { public:     friend class Image;

    // Playback a metafile from a HMETAFILE     // If deleteWmf is TRUE, then when the metafile is deleted,     // the hWmf will also be deleted.  Otherwise, it won’t be.         Metafile(IN HMETAFILE   hWmf,


 


 


I want you to offer a sample.

Give my best regards


 

tera tera Sep 16, 2009 - 7:09 PM

 


In win32 metafile, a figure is not drawn normally.

I think that "class Metafile" for GdiPlus is drawn normally.

I want you to offer a sample source of PrintPreview which incorporated Metafile of GdiPlus.

Please answer it.


/**************************************************************************\ * Copyright (c) 1998-2001, Microsoft Corp.  All Rights Reserved. * Module Name: *   GdiplusMetafile.h * Abstract: *   GDI+ Metafile class \**************************************************************************/

#ifndef _GDIPLUSMETAFILE_H #define _GDIPLUSMETAFILE_H

class Metafile : public Image { public:     friend class Image;

    // Playback a metafile from a HMETAFILE     // If deleteWmf is TRUE, then when the metafile is deleted,     // the hWmf will also be deleted.  Otherwise, it won’t be.         Metafile(IN HMETAFILE   hWmf,

Technical Support Sep 18, 2009 - 3:44 AM

We dig into GDI+ and classic GDI metafiles compatibility problem. The following links contain some interesting information:

http://www.undocprint.org/formats/winspool/emf_plus
http://books.google.com/books?id=ElAaTGP__U0C&pg=PA366&lpg=PA366&dq=printing+in+gdi%2B+emf%2B&source=bl&ots=AgE-P1i-vH&sig=Wde4QxYgxwDOIWa0BSBLHcKV6aA&hl=en&ei=VY2ySvrOEZXJ_gaDnr3MDQ&sa=X&oi=book_result&ct=result&resnum=2#v=onepage&q=&f=false

It looks like GDI+ simply emulates their APIs invocation and translates them into GDI APIs very approximately when the GDI+ is invoked for painting into classic metafiles. It’s logically correct. The classic metafiles (WMF or EMF) are simply saved sequences of classic GDI API invocations. The classic metafiles does not know anything about GDI+ APIs. This means the only way to draw correctly with GDI+ APIs into classic metafiles is to draw into bitmap and the draw composed bitmap into classic metafile. The alternate solution is to re-code Prof-UIS printing/previewing subsystem and make it GDI+ based.

The GDI and GDI+ graphic systems are two absolutely independent software libraries nevertheless they have APIs for integrating with each other. That’s why they are using different metafiles. These two systems are not the only graphic painting APIs in this world. For instance, the Firefox web browser uses the www.cairographics.org system. This library has its own device contexts working similar to classic and GDI+ metafiles. The Cairo library uses SVG and PDF contexts which can be assumed as metafile replacements.

The Prof-UIS library uses classic GDI metafiles in its printing previewing subsystem because all the other classes are using GDI - not GDI+. To switch to GDI+ in the printing/previewing subsystem will require to switch to GDI+ in all the Prof-UIS. It’s possible. But it’s not a quick work.



Technical Support Sep 16, 2009 - 3:45 AM

You can try and draw what you want through GDI plus into standalone GDI plus metafile. Then you should draw GDI plus metafile into Win32 metafile.

tera tera Sep 16, 2009 - 4:13 AM

 


I do a metafile of GDI+ and do forward it to dcEMF?


CMetaFileDC dcEMF;
if( ! dcEMF.CreateEnhanced(

I want a sample code.

Give my best regards