Example 1. Save mathematical expression as image file

In this example, step by step we`ll create a small demo application, that must save mathematical expression as image file.

Step 1.

First of all, we create a form and put our enter field for math expression (MEEL) and the button "Save" on it

add MEEL component and a Button on the form

Step 2.

We define the Action to be performed by pressing the button "Save"

  1.         private void button1_Click(object sender, EventArgs e)
  2.         {
  3.             // save image, background color - White
  4.             Image img = this.mathControl1.SaveToImage(Color.White);
  5.  
  6.             // Create SaveFileDialog
  7.             using (SaveFileDialog dlg = new SaveFileDialog())
  8.             {
  9.                 if (dlg.ShowDialog() == DialogResult.OK)
  10.                 {
  11.                     // save the image into the file
  12.                     img.Save(dlg.FileName);
  13.                 }
  14.             }           
  15.         }

That's all, the application is ready.

Math Expression

 - This program has saved this image to the file