/// <summary> /// Asks the user at design-time if he wants to change the Auto position /// of all areas at the same time. /// </summary> /// <param name="autoValue">Value to be set for the Auto property.</param> private void ResetAllAreasAutoPosition(bool autoValue) { if (resetAreaAutoPosition) { // Proceed only if at design time if (Chart != null && Chart.IsDesignMode() && !Chart.serializing && Chart.Site != null) { // Check if there is more than one area and Auto position set to the same value if (Chart.ChartAreas.Count > 1) { bool firstAutoValue = Chart.ChartAreas[0].Position.Auto; bool sameAutoValue = true; foreach (ChartArea area in Chart.ChartAreas) { if (area.Position.Auto != firstAutoValue) { sameAutoValue = false; break; } } // Proceed only all Auto values are the same if (sameAutoValue) { string message = SR.MessageChangingChartAreaPositionProperty; if (autoValue) { message += SR.MessageChangingChartAreaPositionConfirmAutomatic; } else { message += SR.MessageChangingChartAreaPositionConfirmCustom; } IDesignerMessageBoxDialog confirm = Chart.Site.GetService(typeof(IDesignerMessageBoxDialog)) as IDesignerMessageBoxDialog; if (confirm != null && confirm.ShowQuestion(message)) { foreach (ChartArea area in Chart.ChartAreas) { if (autoValue) { this.SetPositionNoAuto(0f, 0f, 0f, 0f); } area.Position._auto = autoValue; } } } } } } }
/// <summary> /// Initializes the specified item. /// </summary> /// <param name="item">The item.</param> internal override void Initialize(Annotation item) { if (item != null) { TextAnnotation textAnnotation = item as TextAnnotation; if (textAnnotation != null && string.IsNullOrEmpty(textAnnotation.Text) && Chart != null && Chart.IsDesignMode()) { textAnnotation.Text = item.Name; } //If the collection belongs to annotation group we need to pass a ref to this group to all the child annotations if (this.AnnotationGroup != null) { item.annotationGroup = this.AnnotationGroup; } item.ResetCurrentRelativePosition(); } base.Initialize(item); }