本文介绍了通过c#代码生成.dwg文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述









我正在编辑图像,将其加载到pictureBox中。当我完成更改后,我想将图像保存为.dwg文件,但是当我想打开文件时,AUTOCAD无法识别,因此我无法在AUTOCAD上打开文件。有没有什么方法可以从c#中编辑的图像中获取正确的.dwg文件?



这是我用来获取的代码。 dwg文件,它适用于jpg文件,但不适用于.dwg文件

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

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

推荐答案


这篇关于通过c#代码生成.dwg文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 06:35