/// <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(); }
public override void ZoomBounds(System.Windows.Forms.Control control, ZoomBoundsInfo infos) { C1Chart3D chart = control as C1Chart3D; ZoomChartGroups(infos, chart.ChartGroups); ZoomChartArea(infos, chart.ChartArea); ZoomTitle(infos, chart.Header); ZoomTitle(infos, chart.Footer); ZoomLegend(infos, chart.Legend); ZoomChartLabels(infos, chart.ChartLabels); base.ZoomBounds(control, infos); }
/// <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); } }
/// <summary> /// Creates a form and show the localization XML for the specified chart. /// /// The localization XML is saved to a byte array for easy conversion to /// text. Note that the first bytes of the array may be byte encodings. /// /// The form is sizeable. /// </summary> /// <param name="objChart"></param> private void showLocalizations(object objChart) { string title = " string localizations."; byte[] ChartLocalizationBytes = null; if (objChart is C1Chart) { C1Chart chart = objChart as C1Chart; chart.SaveLocalizations(out ChartLocalizationBytes); title = chart.Name + title; } else if (objChart is C1Chart3D) { C1Chart3D chart = objChart as C1Chart3D; chart.SaveLocalizations(out ChartLocalizationBytes); title = chart.Name + title; } else { MessageBox.Show("Object specified is not supported."); return; } string ChartLocalizationString = Encoding.UTF8.GetString(ChartLocalizationBytes); Form frm = new Form(); TextBox tb = new TextBox(); frm.Text = title; frm.Size = this.Size; frm.WindowState = FormWindowState.Normal; frm.FormBorderStyle = FormBorderStyle.Sizable; frm.Controls.Add(tb); tb.Dock = DockStyle.Fill; tb.Multiline = true; tb.ReadOnly = true; tb.ScrollBars = ScrollBars.Both; tb.Text = ChartLocalizationString; tb.SelectionStart = 0; tb.SelectionLength = 0; tb.Visible = true; frm.Show(); }
public override void ZoomFont(System.Windows.Forms.Control control, ZoomFontInfo infos) { base.ZoomFont(control, infos); C1Chart3D chart = control as C1Chart3D; ZoomChartGroups(infos, chart.ChartGroups); ZoomChartArea(infos, chart.ChartArea); ZoomTitle(infos, chart.Header); ZoomTitle(infos, chart.Footer); ZoomLegend(infos, chart.Legend); ZoomChartLabels(infos, chart.ChartLabels); ZoomStyle(infos, chart.Style); ZoomStyle(infos, chart.AreaStyle); ZoomStyle(infos, chart.DefaultLabelStyle); ZoomStyle(infos, chart.FooterStyle); ZoomStyle(infos, chart.HeaderStyle); ZoomStyle(infos, chart.LegendStyle); }
/// <summary> /// Creates a form and adds a PropertyGrid connected to the specified chart. /// The localizations of the Property Descriptions can be seen. /// /// Special Note: Once a control property description has been /// retrieved, it does not change for the application. This is a /// behavior of the .NET PropertyDescriptor. /// /// The form is sizeable. /// </summary> /// <param name="objChart"></param> private void showPropertyGrids(object objChart) { string title = " Property Grid."; Form frm = new Form(); PropertyGrid pg = new PropertyGrid(); if (objChart is C1Chart) { C1Chart chart = objChart as C1Chart; pg.SelectedObject = chart; title = chart.Name + title; } else if (objChart is C1Chart3D) { C1Chart3D chart = objChart as C1Chart3D; pg.SelectedObject = chart; title = chart.Name + title; } else { MessageBox.Show("Object specified is not supported."); return; } frm.Text = title; frm.Size = new Size(300, 400); frm.WindowState = FormWindowState.Normal; frm.FormBorderStyle = FormBorderStyle.Sizable; frm.Controls.Add(pg); pg.Dock = DockStyle.Fill; pg.HelpVisible = true; frm.Show(); }