Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,



I'm editing a image, loading it in a pictureBox. When i've done the changes i want to save the image as a .dwg file, but when i want to open the file AUTOCAD doesnt recognise so i'm not able to open the file on AUTOCAD. Is there any way which i can obtain a correct .dwg file, from a edited image in c#?

This is the code that i'm using to obtain the .dwg file, it works for jpg file, but not for .dwg file
C#
private void Generar_Click(object sender, EventArgs e)
{
            SaveFileDialog Guardar = new SaveFileDialog();
            Guardar.Filter =    "DWG(*.dwg)|*DWG|DXG(*.DXG)|*.DXG|JPEG(*.JPG)|*.JPG|BMP(*.BMP)|*.BMP";
            Bitmap bmp = new Bitmap(pictureBox.Image);
            Graphics gr = Graphics.FromImage(bmp);
            Pen p = new Pen(Color.Red);
            p.Width = 5.0f;
            gr.DrawRectangle(p, 1, 2, 30, 40);
            pictureBox.Image = bmp;
            Image Imagen = pictureBox.Image;
            Guardar.ShowDialog();
            Imagen.Save(Guardar.FileName);
}

Thanks
Posted

1 solution

Unless you have a library that knows how to write a DWG file, you're going to have to write one. The built in stuff in .NET doesn't know anything at all about how to write a DWG file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900