Simple Usage

Discuss and ask questions about Pocket PC CAD Viewer.

Moderators: support, SDS, admin

Post Reply
hairry_p0tter
Posts: 6
Joined: 18 Feb 2009, 01:50

Simple Usage

Post by hairry_p0tter » 18 Feb 2009, 01:58

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

support
Posts: 2930
Joined: 30 Mar 2005, 11:36
Contact:

Re: Simple Usage

Post by support » 18 Feb 2009, 15:12

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.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

hairry_p0tter
Posts: 6
Joined: 18 Feb 2009, 01:50

Re: Simple Usage

Post by hairry_p0tter » 18 Feb 2009, 22:24

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


support
Posts: 2930
Joined: 30 Mar 2005, 11:36
Contact:

Re: Simple Usage

Post by support » 19 Feb 2009, 11:39

Hello Harry,

There is no need to replace FCADImage = new CADImage(); by FCADImage = new DWG.DWGImage();. It is necessary just to set a filter for the openFileDialog: "DWG Files (*.dwg) |*.dwg".

Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

hairry_p0tter
Posts: 6
Joined: 18 Feb 2009, 01:50

Re: Simple Usage

Post by hairry_p0tter » 19 Feb 2009, 13:53

Sergey,

If i do not replace FCADImage = new CADImage(); by FCADImage = new DWG.DWGImage(); the i get an error "incompatible file type".

But that is not the problem.

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

I have attached the sample project with your source code. Let me know if it runs at your end.

Harry

support
Posts: 2930
Joined: 30 Mar 2005, 11:36
Contact:

Re: Simple Usage

Post by support » 19 Feb 2009, 14:24

Hello Harry,

Please send us the package to support@cadsofttools.com.

Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply