/// <summary> /// Handles the MouseMove event. /// </summary> /// <param name="e">The event arguments.</param> protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); DrawingMetrics m = HitTest(new PointF(e.X, e.Y)); SetFocusedItem(m == null ? null : m.Item); }
/// <summary> /// Constructs the array of DrawingMetrics, which store drawing information about each pie slice. /// </summary> private List <DrawingMetrics> ConstructDrawingMetrics(Rectangle bounds, Padding padding) { List <DrawingMetrics> results = new List <DrawingMetrics>(); try { // increment the transaction reference counter so that any modifications in this method don't lead to a recursive redrawing of the control. transactionRef++; if (Items.TotalItemWeight == 0) { return(results); } if (Style.AutoSizePie) { Style.RadiusInternal = GetAutoSizeRadius(bounds, padding); } float angleUsed = Style.Rotation; for (int i = 0; i < Items.Count; i++) { DrawingMetrics dm = new DrawingMetrics(this, Items[i], bounds, angleUsed, (float)(Items[i].Percent * Math.PI * 2)); results.Add(dm); angleUsed += (float)dm.SweepAngle; } // sort the drawing metrics in the order they should be drawn results.Sort(); } finally { // end our transaction transactionRef--; } return(results); }
/// <summary> /// Constructs the array of DrawingMetrics, which store drawing information about each pie slice. /// </summary> private List<DrawingMetrics> ConstructDrawingMetrics(Rectangle bounds, Padding padding) { List<DrawingMetrics> results = new List<DrawingMetrics>(); try { // increment the transaction reference counter so that any modifications in this method don't lead to a recursive redrawing of the control. transactionRef++; if (Items.TotalItemWeight == 0) return results; if (Style.AutoSizePie) Style.RadiusInternal = GetAutoSizeRadius(bounds, padding); float angleUsed = Style.Rotation; for (int i = 0; i < Items.Count; i++) { DrawingMetrics dm = new DrawingMetrics(this, Items[i], bounds, angleUsed, (float)(Items[i].Percent * Math.PI * 2)); results.Add(dm); angleUsed += (float)dm.SweepAngle; } // sort the drawing metrics in the order they should be drawn results.Sort(); } finally { // end our transaction transactionRef--; } return results; }