Click here to Skip to main content
15,921,660 members
Home / Discussions / C#
   

C#

 
GeneralProblems reading through XML file with XPathNavigator and XPathNodeIterator Pin
huckfinn14-Jan-05 4:57
huckfinn14-Jan-05 4:57 
GeneralRe: Problems reading through XML file with XPathNavigator and XPathNodeIterator Pin
leppie14-Jan-05 5:55
leppie14-Jan-05 5:55 
GeneralCOM in C# (regarding MSMQ) Pin
Esmo200014-Jan-05 4:44
Esmo200014-Jan-05 4:44 
GeneralExtracting Data From Text Files Pin
lizim14-Jan-05 3:52
lizim14-Jan-05 3:52 
GeneralRe: Extracting Data From Text Files Pin
Nick Parker14-Jan-05 4:09
protectorNick Parker14-Jan-05 4:09 
GeneralRe: Extracting Data From Text Files Pin
lizim14-Jan-05 4:17
lizim14-Jan-05 4:17 
GeneralRe: Extracting Data From Text Files Pin
Wayne Phipps14-Jan-05 22:59
Wayne Phipps14-Jan-05 22:59 
Generalmetafiles - physical dimensions in mm Pin
jadamcrain14-Jan-05 3:47
jadamcrain14-Jan-05 3:47 
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
crain@physics.unc.edu
GeneralDistribute separate forms Pin
Jassim Rahma14-Jan-05 3:34
Jassim Rahma14-Jan-05 3:34 
GeneralRe: Distribute separate forms Pin
Nick Parker14-Jan-05 4:04
protectorNick Parker14-Jan-05 4:04 
GeneralUSB Printer Pin
Peter Beedell14-Jan-05 1:13
Peter Beedell14-Jan-05 1:13 
GeneralRe: USB Printer Pin
Dave Kreskowiak14-Jan-05 4:49
mveDave Kreskowiak14-Jan-05 4:49 
GeneralMulti Column TreeView Pin
orlyg14-Jan-05 0:23
orlyg14-Jan-05 0:23 
GeneralRe: Multi Column TreeView Pin
Robert Rohde14-Jan-05 1:02
Robert Rohde14-Jan-05 1:02 
GeneralOleDbException (exclusive access) Pin
Serge Lobko-Lobanovsky14-Jan-05 0:13
Serge Lobko-Lobanovsky14-Jan-05 0:13 
GeneralRe: OleDbException (exclusive access) Pin
Mike Dimmick14-Jan-05 0:48
Mike Dimmick14-Jan-05 0:48 
GeneralRe: OleDbException (exclusive access) Pin
Serge Lobko-Lobanovsky14-Jan-05 0:56
Serge Lobko-Lobanovsky14-Jan-05 0:56 
GeneralCalling CDialog C++ code from C# Pin
gabnicu13-Jan-05 23:50
gabnicu13-Jan-05 23:50 
GeneralRe: Calling CDialog C++ code from C# Pin
Nick Parker14-Jan-05 3:33
protectorNick Parker14-Jan-05 3:33 
Generaldatabase mdb Pin
Syasya Mortensen13-Jan-05 22:09
Syasya Mortensen13-Jan-05 22:09 
GeneralRe: database mdb Pin
Yulianto.13-Jan-05 22:30
Yulianto.13-Jan-05 22:30 
GeneralRe: database mdb Pin
Syasya Mortensen14-Jan-05 4:24
Syasya Mortensen14-Jan-05 4:24 
GeneralRe: database mdb Pin
Syasya Mortensen16-Jan-05 20:59
Syasya Mortensen16-Jan-05 20:59 
GeneralRe: database mdb Pin
Nick Parker14-Jan-05 3:41
protectorNick Parker14-Jan-05 3:41 
GeneralRe: database mdb Pin
Syasya Mortensen14-Jan-05 4:26
Syasya Mortensen14-Jan-05 4:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.