/// <summary> /// Localizes the specified chart object by adding the specified /// prefix in groupBox2 to the beginning of each localizable string. /// /// Of course, no one would really want to do this, but it /// demonstrates how to modify and localize the strings used in the /// dialogs and property descriptions. /// </summary> /// <param name="objChart"></param> private void localizeChart(object objChart) { // a MemoryStream is used for demo purposes. MemoryStream ChartLocalizationStream = new MemoryStream(); if (objChart is C1Chart) { C1Chart chart = objChart as C1Chart; if (chart.SaveLocalizations(ChartLocalizationStream)) { addPrefixToLocalizations(ChartLocalizationStream); chart.LoadLocalizations(ChartLocalizationStream); } } else if (objChart is C1Chart3D) { C1Chart3D chart = objChart as C1Chart3D; if (chart.SaveLocalizations(ChartLocalizationStream)) { addPrefixToLocalizations(ChartLocalizationStream); chart.LoadLocalizations(ChartLocalizationStream); } } ChartLocalizationStream.Close(); ChartLocalizationStream.Dispose(); }
/// <summary> /// Resets the chart localizations to the default state for the /// specified chart. This removes previous localizations and /// frees all memory associated with the localizations. /// </summary> /// <param name="objChart"></param> private void resetLocalizations(object objChart) { // passing null to any of the LoadLocalization overload // clears any existing localizations previously loaded. if (objChart is C1Chart) { C1Chart chart = objChart as C1Chart; chart.LoadLocalizations((Stream)null); } else if (objChart is C1Chart3D) { C1Chart3D chart = objChart as C1Chart3D; chart.LoadLocalizations((Stream)null); } }