Hello,
I'm currently working on making our code warning-free, and because of that I would like to eliminate the obsolete warning generated by a teechart property:
tChart1.Export.Image.Metafile.Enhanced = false;
I didn't write this code, but if I'm right this way we export a Windows Metafile instead of EMF. But this generates the following warning:
warning CS0618: 'Steema.TeeChart.Export.MetafileFormat.Enhanced' is obsolete: 'Please use EMFFormat property.'
The problem is that the suggested EmfFormat property accepts EMFTypes values, which can only be:
- EmfOnly
- EmfPlusDual
- EmfPlusOnly
Obviously this is not the way to go if one wants to export to WMF. So my question is how to resolve the above obsolete warning?
Export.MetafileFormat.Enhanced obsolete warning
-
- Newbie
- Posts: 7
- Joined: Fri Sep 07, 2007 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Export.MetafileFormat.Enhanced obsolete warning
Hi DieterDHoker,
We have been investigating the issue. You'll probably need .NET Reflector to follow what I will explain here.
If you open TeeChart.dll and go to the class member Steema.TeeChart.Chart.Metafile(Graphics gRef, Stream stream, Chart aChart, int width, int height, EmfType type). There we use the .NET framework class System.Drawing.Imaging.Metafile. Have a look at this class in Reflector, specifically we use the public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type); constructor. If you look at it in the disassembler:
This constructor overload uses an EmfType anyway. In fact, looking at all the constructors of the System.Drawing.Imaging.Metafile class, they all use an EmfType. This means we can not use the System.Drawing.Imaging.Metafile class to create a WMF. Therefore we can not create a WMF using the .NET framework classes.
An otion would be using p/invoke on gdi32.dll to convert EMF to WMF files. You could use it that on your own code, based on the GetWinMetaFileBits function.
We have been investigating the issue. You'll probably need .NET Reflector to follow what I will explain here.
If you open TeeChart.dll and go to the class member Steema.TeeChart.Chart.Metafile(Graphics gRef, Stream stream, Chart aChart, int width, int height, EmfType type). There we use the .NET framework class System.Drawing.Imaging.Metafile. Have a look at this class in Reflector, specifically we use the public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type); constructor. If you look at it in the disassembler:
Code: Select all
public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) : this(stream, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) { }
An otion would be using p/invoke on gdi32.dll to convert EMF to WMF files. You could use it that on your own code, based on the GetWinMetaFileBits function.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |