/// <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));
     }
 }
 /// <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));
     }
 }
示例#3
0
            /// <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="drawingBounds">The drawing bounds.</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(ZeroitUltimatePieChart 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();
            }
 /// <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);
 }
示例#5
0
            /// <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>
            /// <exception cref="ArgumentNullException">destinationType</exception>
            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));
            }
 /// <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;
 }
 /// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="item">The item involved with an event.</param>
 public PieChartItemEventArgs(PieChartItem item)
 {
     this.item = item;
 }