473,805 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Metafile issue

Hi there,

I am obtaining a meta file from the clipboard via the following code
Dim CF_ENHMETAFILE As Integer = 14
Dim cMFeImage As Imaging.Metafil e

Dim pIPrClipboard As IntPtr = OpenClipboard(M e.Handle)

If (IsClipboardFor matAvailable(CF _ENHMETAFILE)) Then
Dim pIPrData As IntPtr = GetClipboardDat a(CF_ENHMETAFIL E)
cMFeImage = New Imaging.Metafil e(pIPrData, False)
Call cMFeImage.Save( "c:\pop.emf ", Imaging.ImageFo rmat.emf)
End If

Call CloseClipboard( )
If I display the image in a picture box and redraw it during resize it
looks great, definitely an EMF, but the saved image "pop.emf" is not an
EMF, more like a JPEG, it's been rasterised somewhere along the lines and
now looks awful.

Any ideas what's happening?

If you open a spreadsheet in excel and copy a chart to the clipboard you
can use that. Again, looks great in VB, but not when saved.

BTW, I have tried seeing the 2nd property of the MetaFile constructor to
True / False, same thing happens.

Many thanks in advance.

Nick.
Dec 19 '06 #1
2 1734
It's okay, this problem was resolved.

"NickP" <ni**@nick.comw rote in message
news:OE******** ******@TK2MSFTN GP03.phx.gbl...
Hi there,

I am obtaining a meta file from the clipboard via the following code
Dim CF_ENHMETAFILE As Integer = 14
Dim cMFeImage As Imaging.Metafil e

Dim pIPrClipboard As IntPtr = OpenClipboard(M e.Handle)

If (IsClipboardFor matAvailable(CF _ENHMETAFILE)) Then
Dim pIPrData As IntPtr = GetClipboardDat a(CF_ENHMETAFIL E)
cMFeImage = New Imaging.Metafil e(pIPrData, False)
Call cMFeImage.Save( "c:\pop.emf ", Imaging.ImageFo rmat.emf)
End If

Call CloseClipboard( )
If I display the image in a picture box and redraw it during resize it
looks great, definitely an EMF, but the saved image "pop.emf" is not an
EMF, more like a JPEG, it's been rasterised somewhere along the lines and
now looks awful.

Any ideas what's happening?

If you open a spreadsheet in excel and copy a chart to the clipboard
you can use that. Again, looks great in VB, but not when saved.

BTW, I have tried seeing the 2nd property of the MetaFile constructor
to True / False, same thing happens.

Many thanks in advance.

Nick.

Dec 21 '06 #2
"NickP" <ni**@nick.comw rote:
>If I display the image in a picture box and redraw it during resize it
looks great, definitely an EMF, but the saved image "pop.emf" is not an
EMF, more like a JPEG, it's been rasterised somewhere along the lines and
now looks awful.
It's okay, this problem was resolved.
Could you say how the problem was resolved, please? I'm curious.

--
Lucian
Dec 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4812
by: Julian Ziersch | last post by:
This code causes a severe memory leak - the critical part is the call to GetHenhmetafile(). System.Drawing.Imaging.Metafile lImage = new System.Drawing.Imaging.Metafile("C:\\meta0.emf"); IntPtr h = lImage.GetHenhmetafile(); lImage.Dispose(); lImage.GetLifetimeService(); lImage = null;
1
3932
by: sendhil | last post by:
hi, Iam doing some graphics programming with C#. I have to create a Windows MetaFile from a base64 encoded string. How do i create the file. I want to Overlay this Windows MetaFile on a image which is present in a Picture box. Any ideas to do this? Thanks senthil
3
417
by: Richard Skopal | last post by:
In .NET Windows forms I can create a metafile using this code: Graphics grph = aControl.CreateGraphics(); IntPtr ipHDC = grph.GetHdc(); Metafile mf = new Metafile(aImgFilePath, ipHDC, EmfType.EmfOnly); grph.ReleaseHdc(ipHDC); grph.Dispose(); grph = Graphics.FromImage(mf); grph.DrawRectangle(aPen, 10, 10, 100, 120); grph.Dispose();
2
8020
by: George Yefchak | last post by:
Hi I need to retrieve a metafile image from the clipboard and render it as a bitmap in my application. In particular, an image will be placed on the clipboard by pasting from PowerPoint (I really do need to do this!). The original image is a bitmap, but PowerPoint doesn't place it on the clipboard as such. A call to GetFormats() indicates that MetafilePict and EnhancedMetaFile are available formats. The following does NOT work:
0
1798
by: weiruic | last post by:
I am trying to create a metafile (.emf) on the harddisk, write graphics from a graphics object to it, and then save it. I can do this successfully except I cannot set the horizontal and vertical resolution as those properties of my metafile object are read only and are in fact null until the graphics object is disposed of and the file is saved. When I examine the saved file's properties in Windows Explorer, it has 81 dpi horizontal and...
5
5455
by: Peter | last post by:
Does anyone have a c# or vb.net example of how to convert bitmap to Metafile - preferably without writing anything to a file ? Thank You Peter
2
10356
by: Laurent Navarro | last post by:
Hello, I am using a library which returns a byte containing RAW data, ie all pixels' color values coded in a byte array without header. I would like to save those data into a JPEG file so I tried to use the MetaFile class. byte data; (...) // Creating the RAW image through the DLL call. MemoryStream memoryStream = new MemoryStream(data);
2
2553
by: Alexander Gorbylev | last post by:
Hi! Let the size of vector is e.g. 3.5". I render the same vector on a printer & a screen on the same procedure: printDoc_BeginPrint(object sender, PrintEventArgs e) { .... vector.Width * g.DpiX ....
1
3638
by: bern11 | last post by:
I can get bitmaps from the clipboard, but how do I get Metafiles? The specific instance I am testing is copying a piece of Word clip-art into the clipboard and trying to read it in an application. It appears as a metafile type but isn't recognized as an image. Given: DataObject copyObject; copyObject = (DataObject)Clipboard.GetDataObject(); string types = copyObject.GetFormats();
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10609
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10360
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10105
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9185
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5542
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.