// 读取CAD文件 private void openFile_Click(object sender, EventArgs e) { OpenFileDialog file = new OpenFileDialog(); if (file.ShowDialog() == DialogResult.OK) { string exName = Path.GetExtension(file.FileName); if (string.Equals(exName, ".dwg")) { dwgFile = file.FileName; MessageBox.Show("CAD文件读取成功"); if (dwgFile != null) { ViewDWG viewDwg = new ViewDWG(); pictureBox1.Image = viewDwg.ShowDWG(400, 450, dwgFile); } else { MessageBox.Show("请先读取CAD文件"); } } else { MessageBox.Show("请选择.dwg文件"); } } }
// 显示缩略图 private void ShowThumb_Click(object sender, EventArgs e) { if (dwgFile != null) { ViewDWG viewDwg = new ViewDWG(); // string path = "d:\\毕设资料\\CAD二次开发\\XXXXDCW04-3000-00.dwg"; pictureBox1.Image = viewDwg.ShowDWG(100, 200, dwgFile); } else { MessageBox.Show("请先读取CAD文件"); } }