Esempio n. 1
0
 /// <summary>
 /// Called to fire an ItemFocusChanging event.
 /// </summary>
 /// <param name="oldItem">The item that was previously focused.</param>
 /// <param name="newItem">The item that is gaining focus.</param>
 private void FireItemFocusChanging(PieChartItem oldItem, PieChartItem newItem)
 {
     if (ItemFocusChanging != null)
     {
         ItemFocusChanging(this, new PieChartItemFocusEventArgs(oldItem, newItem));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Called to fire an ItemDoubleClicked event.
 /// </summary>
 /// <param name="item">The event arguments.</param>
 private void FireItemDoubleClicked(PieChartItem item)
 {
     if (ItemDoubleClicked != null)
     {
         ItemDoubleClicked(this, new PieChartItemEventArgs(item));
     }
 }
            /// <summary>
            /// Constructs a new DrawingMetrics.
            /// </summary>
            /// <param name="control">The control this object is associated with.</param>
            /// <param name="item">The item this object is associated with.</param>
            /// <param name="startAngle">The start angle of this pie slice, in radians.</param>
            /// <param name="sweepAngle">The sweep angle of this pie slice, in radians.</param>
            public DrawingMetrics(PieChart control, PieChartItem item, Rectangle drawingBounds, float startAngle, float sweepAngle)
            {
                this.control       = control;
                this.item          = item;
                this.drawingBounds = drawingBounds;
                this.startAngle    = (float)(startAngle % (2 * Math.PI));
                this.sweepAngle    = sweepAngle;

                ConstructGraphics();
                ConstructPaths();
                ConstructRegions();
            }
Esempio n. 4
0
 /// <summary>
 /// Gets the display text for a PieChartItem in the collection list.
 /// </summary>
 /// <param name="value">The PieChartItem to get the display text for.</param>
 /// <returns>The string that will be displayed for the PieChartItem.</returns>
 protected override string GetDisplayText(object value)
 {
     if (value is PieChartItem)
     {
         PieChartItem item = (PieChartItem)value;
         if (!string.IsNullOrEmpty(item.Text))
         {
             return(string.Format("{0} [weight {1:f3}]", item.Text, item.Weight));
         }
         else
         {
             return(string.Format("[weight {0:f3}]", item.Weight));
         }
     }
     return(value.GetType().Name);
 }
            /// <summary>
            /// Converts the given value object to the specified type, using the specified context and culture information.
            /// </summary>
            /// <param name="context">An ITypeDescriptorContext that provides a format context.</param>
            /// <param name="culture">A CultureInfo. If a null reference is passed, the current culture is assumed.</param>
            /// <param name="value">The Object to convert.</param>
            /// <param name="destinationType">The type to convert the value parameter to.</param>
            /// <returns>An object that represents the converted value.</returns>
            public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
            {
                if (destinationType == null)
                {
                    throw new ArgumentNullException("destinationType");
                }

                if (destinationType == typeof(InstanceDescriptor) && (value is PieChartItem))
                {
                    PieChartItem item       = (PieChartItem)value;
                    ArrayList    collection = new ArrayList();
                    collection.Add(item.Weight);
                    collection.Add(item.Color);
                    collection.Add(item.Text);
                    collection.Add(item.ToolTipText);
                    collection.Add(item.Offset);
                    return(new InstanceDescriptor(value.GetType().GetConstructor(new Type[] { typeof(double), typeof(Color), typeof(string), typeof(string), typeof(float) }), collection));
                }

                return(base.ConvertTo(context, culture, value, destinationType));
            }
Esempio n. 6
0
        /// <summary>
        /// Set the currently focused PieChartItem.
        /// </summary>
        /// <param name="item">The item that currently has mouse focus.</param>
        private void SetFocusedItem(PieChartItem item)
        {
            if (item != this.FocusedItem)
            {
                FireItemFocusChanging(this.FocusedItem, item);
                this.focusedItem = item;
                FireItemFocusChanged();

                MarkVisualChange(true);
            }

            // check to see if the item has a tool tip and if it should be displayed
            if (this.FocusedItem != null && this.FocusedItem.ToolTipText != null && this.Style.ShowToolTips)
            {
                toolTip.SetToolTip(this, this.FocusedItem.ToolTipText);
            }
            else
            {
                toolTip.RemoveAll();
            }
        }
Esempio n. 7
0
 /// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="oldItem">The item that is losing focus.</param>
 /// <param name="newItem">The item that is gaining focus.</param>
 public PieChartItemFocusEventArgs(PieChartItem oldItem, PieChartItem newItem)
 {
     this.oldItem = oldItem;
     this.newItem = newItem;
 }
Esempio n. 8
0
 /// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="item">The item involved with an event.</param>
 public PieChartItemEventArgs(PieChartItem item)
 {
     this.item = item;
 }