private void applyHeightMap(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; if (!isHeightMapApplied) { loadHeightMap(sender, e); codeBeforeHeightMap.Clear(); foreach (string codeline in fCTBCode.Lines) { if (codeline.Length > 0) { codeBeforeHeightMap.AppendLine(codeline); } } VisuGCode.getGCodeLines(fCTBCode.Lines); fCTBCode.Text = VisuGCode.applyHeightMap(fCTBCode.Lines, _heightmap_form.Map); update_GCode_Depending_Controls(); _heightmap_form.setBtnApply(isHeightMapApplied); isHeightMapApplied = true; } else { fCTBCode.Text = codeBeforeHeightMap.ToString(); update_GCode_Depending_Controls(); _heightmap_form.setBtnApply(isHeightMapApplied); isHeightMapApplied = false; } Cursor.Current = Cursors.Default; }