Methods


Plot/PlotPreview


This sample shows the Plot and PlotPreview methods:

C#

using System;
using System.Windows.Forms;
using DXFReaderNET;

namespace PlotPreview
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object senderEventArgs e)
        {
            dxfReaderNETControl1.NewDrawing();
            dxfReaderNETControl1.CustomCursor = CustomCursorType.CrossHair;
        }

        private void button1_Click(object senderEventArgs e)
        {
            openFileDialog1.DefaultExt = "dxf";
            openFileDialog1.Filter = "DXF|*.dxf|All files (*.*)|*.*";
            openFileDialog1.FileName = "";

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                dxfReaderNETControl1.ReadDXF(openFileDialog1.FileName);
                
            }
        }

        private void button2_Click(object senderEventArgs e)
        {
            dxfReaderNETControl1.PlotMode = PlotModeType.Display;
            dxfReaderNETControl1.PlotRendering = PlotRenderingType.Monochrome ;

            printPreviewControl1.Visible = true;
            dxfReaderNETControl1.Visible = false;
            printPreviewControl1.Location = dxfReaderNETControl1.Location;
            printPreviewControl1.Size = dxfReaderNETControl1.Size;
            
            button2.Enabled = false;
            button1.Enabled = false;
            button3.Enabled = true;

            dxfReaderNETControl1.PlotPreview(printPreviewControl1);
        }

        private void button3_Click(object senderEventArgs e)
        {
            printPreviewControl1.Visible = false;
            dxfReaderNETControl1.Visible = true;

            button2.Enabled = true;
            button1.Enabled = true;
            button3.Enabled = false;
        }

        private void button4_Click(object senderEventArgs e)
        {
            PrintDialog printDialog = new PrintDialog();

            if (printDialog.ShowDialog() == DialogResult.OK)
            {
                dxfReaderNETControl1.Plot(printDialog.PrinterSettings.PrinterNameprintDialog.PrinterSettings.Copies);
            }
        }
    }
}


Here you can find the printed drawing.


Download C# code

 


Warning!
All samples, data, places and images in this section are only for tutorial scope. They are fictitious and may not correspond to real cases.

Any similarities to actual persons or places is merely coincidental.

To evaluate all code samples you need to download and install the DXFReader.NET Compoonent first.