Page 1 of 1

Simple Usage

Posted: 18 Feb 2009, 01:57
by hairry_p0tter
Hi,

i have downloaded the CAD Import .NET for Compact Framework and have been able to run the Poclet PC CAD Viewer.

I checked through the documentation and found only the api help.

Is there a simple example / code to just DISPLAY a sample .dwg file ONLY instead of all the code and functionality found in the viewer.

I prefer to start simple and then add more code and complexity.

Thanks,

Harry

Re: Simple Usage

Posted: 18 Feb 2009, 15:44
by support
Hello Harry,

Here goes the code of a simple application with the only "Open file..." button:

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CADImport;

namespace SamplePocketPC2003
{
    public partial class Form1 : Form
    {
        CADImage FCADImage;
        Rectangle curClRect;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                FCADImage = new CADImage();
                FCADImage.LoadFromFile(dlg.FileName);
            }
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            if (FCADImage != null)
                FCADImage.Draw(e.Graphics, new RectangleF(0, 0, (float)FCADImage.AbsWidth, (float)FCADImage.AbsHeight), this.ClientRectangle);
        }
    }
}
Sergey.

Re: Simple Usage

Posted: 18 Feb 2009, 22:20
by hairry_p0tter
Hi Sergey,

Thanks for your response. If it works i do intend purchasing the product.

But the problem is getting it to work as simple as possible:

Your code does not factor my problem statement. I had clearly mentioned that i need to "DISPLAY a sample .dwg file ONLY".

Hence I have made the changes to your code: FCADImage = new DWG.DWGImage();

But your code is still unable to display the same CAD files your viewer is able to display. All i get is a black form.

I have attached the URL to my VS2008 project with your code embedded. Hope you can help.

http://rapidshare.com/files/199691178/z ... 1.rar.html

Regards,

Harry

Re: Simple Usage

Posted: 24 Feb 2009, 14:28
by support
Hello Harry,

We have received your demo. The matter is that your file has DWG 2007 format. It is not supported by current version of CAD Import .NET for Compact Framework. We will inform you when update is available.

Sergey.