TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
crain
NA
1
0
metafiles and physical units
Jan 14 2005 11:08 AM
Hi, I am trying to create an enhanced metafile that draws several retangles. I want the rectangles to have physical dimensions in mm, so that they will be cut by a laser engraver in these units. The code below attempts to create an EMF with a single rectange 100mm by 100mm, but when I open it in Corel Draw, it says the rectangle is only 94.5mm by 88.6mm. Can anyone explain this disparity to me? public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // // Create temporary Graphics object for metafile // creation and get handle to its device context. Graphics newGraphics = this.CreateGraphics(); IntPtr hdc = newGraphics.GetHdc(); // Create metafile object to record. Metafile metaFile1 = new Metafile("SampMeta.emf", hdc); // Create graphics object to record metaFile. Graphics metaGraphics = Graphics.FromImage(metaFile1); //Set the graphics unit to mm metaGraphics.PageUnit = GraphicsUnit.Millimeter; // Draw rectangle in metaFile. metaGraphics.DrawRectangle(new Pen(Color.Black, 5), 0, 0, 100, 100); // Create comment and add to metaFile. byte[] metaComment = {(byte)'T', (byte)'e', (byte)'s', (byte)'t'}; metaGraphics.AddMetafileComment(metaComment); // Dispose of graphics object. metaGraphics.Dispose(); // Dispose of metafile. metaFile1.Dispose(); // Release handle to temporary device context. newGraphics.ReleaseHdc(hdc); // Dispose of scratch graphics object. newGraphics.Dispose(); } J Adam Crain UNC-CH Department of Physics and Astronomy
[email protected]
Reply
Answers (
1
)
Displaying icons in a PictureBox
Framming a photo