/// <summary> /// Save the template /// </summary> private void mnuSave_Click(object sender, EventArgs e) { if (m_currentTemplate == null) { return; } if (string.IsNullOrEmpty(m_currentTemplate.FileName)) { var saveDialog = new SaveFileDialog { Title = "Save Template", Filter = "Marker Engine XML (*.mxml)|*.mxml", AddExtension = true }; if (saveDialog.ShowDialog() == DialogResult.OK) { m_currentTemplate.FileName = saveDialog.FileName; } else { return; } } m_currentTemplate.Save(); }
public static void Run() { // ExStart:DynamicallyCreateOMRTemplates // The path to the documents directory. string dataDir = RunExamples.GetDataDir_OMR(); OmrTemplate template = new OmrTemplate(); OmrPage page = template.Pages[0]; page.Width = 215.9; page.Height = 279.4; PointF choiceBoxPosition = new PointF(20, 5); // 20 mm to the right, 5 mm from the top SizeF choiceBoxSize = new SizeF(12, 24); ChoiceBoxElement choiceBox = new ChoiceBoxElement("AnotherElement", choiceBoxPosition, choiceBoxSize); choiceBox.IsHorizontal = false; choiceBox.Cells.Add(new OmrCell("A")); // Three marks: (A) (B) (C) choiceBox.Cells.Add(new OmrCell("B")); choiceBox.Cells.Add(new OmrCell("C")); page.Elements.Add(choiceBox); template.Save(dataDir + "New_template_out.amr"); // ExEnd:DynamicallyCreateOMRTemplates }