private void SetCurrentIndexElementClipArea( int currentIndex, RatingElementType elementType, RatingVisualElement element) { switch (elementType) { case RatingElementType.Hover: Point relativePoint1 = this.GetRelativePoint(currentIndex, (RatingBaseVisualElement)element.HoverElement, new double?(this.HoverValue)); element.HoverElement.ClipArea = this.GetCurrentElementClipArea((RatingBaseVisualElement)element.HoverElement, relativePoint1); break; case RatingElementType.Value: Point relativePoint2 = this.GetRelativePoint(currentIndex, (RatingBaseVisualElement)element.ValueElement, this.Value); element.ValueElement.ClipArea = this.GetCurrentElementClipArea((RatingBaseVisualElement)element.ValueElement, relativePoint2); break; case RatingElementType.SelectedValue: Point relativePoint3 = this.GetRelativePoint(currentIndex, (RatingBaseVisualElement)element.SelectedValueElement, new double?(this.SelectedValue)); element.SelectedValueElement.ClipArea = this.GetCurrentElementClipArea((RatingBaseVisualElement)element.SelectedValueElement, relativePoint3); break; default: throw new InvalidEnumArgumentException(); } }
private void PaintLayer(int currentIndex, RatingElementType elementType) { int num = 0; if (this.RightToLeft && this.ElementOrientation == Orientation.Horizontal) { for (int index = this.items.Count - 1; index >= 0; --index) { RatingVisualElement element = this.items[index] as RatingVisualElement; if (num < currentIndex) { this.SetLowerIndexElementsClipArea(elementType, element); } else if (num == currentIndex) { this.SetCurrentIndexElementClipArea(currentIndex, elementType, element); } else { this.SetHigherIndexElementsClipArea(elementType, element); } ++num; element.Invalidate(); } } else { foreach (RatingVisualElement element in (RadItemCollection)this.Items) { if (element.BoundingRectangle.X + element.BoundingRectangle.Width > this.ElementsLayout.BoundingRectangle.Width || this.ElementsLayout.BoundingRectangle.Width < element.MinSize.Width || this.ElementsLayout.BoundingRectangle.Height < element.BoundingRectangle.Height + element.BoundingRectangle.Y) { element.Visibility = ElementVisibility.Hidden; } else { element.Visibility = ElementVisibility.Visible; if (num < currentIndex) { this.SetLowerIndexElementsClipArea(elementType, element); } else if (num == currentIndex) { this.SetCurrentIndexElementClipArea(currentIndex, elementType, element); } else { this.SetHigherIndexElementsClipArea(elementType, element); } ++num; element.Invalidate(); } } } }
private void SetHigherIndexElementsClipArea( RatingElementType elementType, RatingVisualElement element) { switch (elementType) { case RatingElementType.Hover: element.HoverElement.ClipArea = this.GetElementClipArea((RatingBaseVisualElement)element.HoverElement, false); break; case RatingElementType.Value: element.ValueElement.ClipArea = this.GetElementClipArea((RatingBaseVisualElement)element.ValueElement, false); break; case RatingElementType.SelectedValue: element.SelectedValueElement.ClipArea = this.GetElementClipArea((RatingBaseVisualElement)element.SelectedValueElement, false); break; default: throw new InvalidEnumArgumentException(); } }
protected virtual double UpdateCurrentValue( int currentIndex, RatingVisualElement element, MouseEventArgs e) { double num1 = (this.Maximum - this.Minimum) / (double)this.Items.Count; double num2 = 0.0; float num3 = (float)(e.X - element.LocationToControl().X); float num4 = (float)(e.Y - element.LocationToControl().Y); double num5; if (this.Direction == RatingDirection.Standard) { if (this.ElementOrientation == Orientation.Horizontal) { double num6 = num2 + num1 * (double)currentIndex; num5 = this.SelectionMode != RatingSelectionMode.FullItem ? (this.SelectionMode != RatingSelectionMode.HalfItem ? num6 + (double)num3 / (double)element.Size.Width * num1 : ((double)num3 > (double)(element.Size.Width / 2) ? num6 + num1 : num6 + num1 / 2.0)) : num6 + num1; } else { double num6 = num2 + (double)(this.Items.Count - (currentIndex + 1)) * num1; num5 = this.SelectionMode != RatingSelectionMode.FullItem ? (this.SelectionMode != RatingSelectionMode.HalfItem ? num6 + ((double)element.Size.Height - (double)num4) / (double)element.Size.Height * num1 : ((double)num4 <= (double)(element.Size.Height / 2) ? num6 + num1 : num6 + num1 / 2.0)) : num6 + num1; } } else if (this.ElementOrientation == Orientation.Horizontal) { double num6 = num2 + (double)(this.Items.Count - (currentIndex + 1)) * num1; num5 = this.SelectionMode != RatingSelectionMode.FullItem ? (this.SelectionMode != RatingSelectionMode.HalfItem ? num6 + ((double)element.Size.Width - (double)num3) / (double)element.Size.Width * num1 : ((double)num3 <= (double)(element.Size.Width / 2) ? num6 + num1 : num6 + num1 / 2.0)) : num6 + num1; } else { double num6 = num2 + num1 * (double)currentIndex; num5 = this.SelectionMode != RatingSelectionMode.FullItem ? (this.SelectionMode != RatingSelectionMode.HalfItem ? num6 + (double)num4 / (double)element.Size.Height * num1 : ((double)num4 > (double)(element.Size.Height / 2) ? num6 + num1 : num6 + num1 / 2.0)) : num6 + num1; } return(num5 + this.Minimum); }