private void buttonSaveComponentData_Click(object sender, EventArgs e) { if (textBoxComponentName.Text.Length <= 0) { MessageBox.Show("No File Name!"); return; } if (VtkControl.RectImageData == null || VtkControl.RectPolyData == null) { MessageBox.Show("No Data Selected!"); return; } if (imageRect.Width * imageRect.Height == 0) { imageRect = new Rectangle() { X = 0, Y = 0, Width = VtkControl.ImageWidth, Height = VtkControl.ImageHeight }; } VtkControl.SaveRectData(Config.RuntimeData + textBoxComponentName.Text + ".txt", VtkControl.RectPolyData, imageRect); VtkControl.SaveImageData(Config.RuntimeData + textBoxComponentName.Text + ".bmp", VtkControl.RectImageData); VtkControl.SavePolyData(Config.RuntimeData + textBoxComponentName.Text + ".poly.txt", VtkControl.RectPolyData); MessageBox.Show("Data Saved."); }
private void buttonSetModel_Click(object sender, EventArgs e) { buttonAddModel.BackColor = Color.LightCoral; Application.DoEvents(); if (comboBox3DModel.Text.Length <= 0) { MessageBox.Show("No File Selected!"); return; } if (!File.Exists(comboBox3DModel.Text)) { MessageBox.Show("File Not Exist!"); return; } //Console.WriteLine(comboBox3DModel.Text); VtkControl.ReadDataFromFile(comboBox3DModel.Text); VtkControl.SaveImageData(comboBox3DModel.Text + ".img.bmp", VtkControl.ImageData); pictureBoxImage.Image = Image.FromFile(comboBox3DModel.Text + ".img.bmp"); pictureBoxImage.SizeMode = PictureBoxSizeMode.StretchImage; richTextBox1.Clear(); richTextBox1.AppendText("ImageWidth:" + VtkControl.ImageWidth + "\r\n"); richTextBox1.AppendText("ImageHeight:" + VtkControl.ImageHeight + "\r\n"); //Console.WriteLine("Load Model Finish."); buttonAddModel.BackColor = Color.LightGreen; }