Board index » cppbuilder » Sizing a metafile created and drawn in memory

Sizing a metafile created and drawn in memory


2005-06-09 10:45:39 PM
cppbuilder101
All,
I have a problem setting the size of a graph in a metafile. I want a
square image, but I get my square image only inside of a portrait
retangle. Here is how I create the metafile:
gMetafile = new TMetafile() ;
gMetafile->Enhanced = true ;
// gMetafile->Inch = 1440 ;
// gMetafile->Height = (int)(1440.0 * 20.0 / 2.54 + 0.5) ;
// gMetafile->Width = (int)(1440.0 * 20.0 / 2.54 + 0.5) ;
gMetafile->MMHeight = 20000 ; // 20000 is 200.00 mm = 20.000 cm.
gMetafile->MMWidth = 20000 ; // 20000 is 200.00 mm = 20.000 cm.
The actual file always contains an image 6.67" wide and 7.11"high.
How do I convince the metafile to contain a square image?
If I set the "Enhanced" property to false for WMF instead of EMF and
activate the commented lines, I get the same result, i.e., a portrait
rectangle of the same size.
I appreciate any suggestions and comments.
Cheers, Jochen
hjtrost at microfab dot com
Nil nimium studeo, Caesar, tibi velle placere,
nec scire ut an sis albus an ater homo.
Catullus
 
 

Re:Sizing a metafile created and drawn in memory

On Thu, 09 Jun 2005 09:45:39 -0500, Hans-Jochen Trost
< XXXX@XXXXX.COM >wrote:
Quote
All,

I have a problem setting the size of a graph in a metafile. I want a
square image, but I get my square image only inside of a portrait
retangle. Here is how I create the metafile:

gMetafile = new TMetafile() ;
gMetafile->Enhanced = true ;
// gMetafile->Inch = 1440 ;
// gMetafile->Height = (int)(1440.0 * 20.0 / 2.54 + 0.5) ;
// gMetafile->Width = (int)(1440.0 * 20.0 / 2.54 + 0.5) ;
gMetafile->MMHeight = 20000 ; // 20000 is 200.00 mm = 20.000 cm.
gMetafile->MMWidth = 20000 ; // 20000 is 200.00 mm = 20.000 cm.

The actual file always contains an image 6.67" wide and 7.11"high.
How do I convince the metafile to contain a square image?

If I set the "Enhanced" property to false for WMF instead of EMF and
activate the commented lines, I get the same result, i.e., a portrait
rectangle of the same size.

I appreciate any suggestions and comments.
I should add that I work with BCB5p1 under Windows 200 Pro SP4. After
digging through the archives, I should also add that I get a proper
square image of 7.9"x7.9" under Windows 98, i.e., 20 cm x 20 cm as
desired. So is the answer to give up on TMetafile and go plain Win
API, or is there a fix known meanwhile for TMetafile?
Cheers, Jochen
hjtrost at microfab dot com
Nil nimium studeo, Caesar, tibi velle placere,
nec scire ut an sis albus an ater homo.
Catullus
 

Re:Sizing a metafile created and drawn in memory

"Hans-Jochen Trost" < XXXX@XXXXX.COM >wrote in message
Quote
I should add that I work with BCB5p1 under Windows 200 Pro SP4.
After
digging through the archives, I should also add that I get a proper
square image of 7.9"x7.9" under Windows 98, i.e., 20 cm x 20 cm as
desired. So is the answer to give up on TMetafile and go plain Win
API, or is there a fix known meanwhile for TMetafile?
Why don't you try the graphics group ?
HTH
Jonathan
 

{smallsort}