Ejemplo n.º 1
0
        private void DrawClippedCurrentNoteBar(Graphics gr, RectangleF rect, int currentNoteIndex)
        {
            rect.Inflate(_noteBarShapeInflateValue, _noteBarShapeInflateValue);
            if (_activeNoteBarFrameColor != Color.Empty)
            {
                rect.Inflate(-1, -1);
            }

            float      rateHeight;
            RatingNote note = _ratings[currentNoteIndex];

            if (_currentNoteValue == note.ToValue)
            {
                rateHeight = rect.Height;
            }
            else if (_currentNoteValue == note.FromValue)
            {
                rateHeight = 1;
            }
            else
            {
                rateHeight = rect.Height * (_currentNoteValue - note.FromValue) / (note.ToValue - note.FromValue);
                rateHeight = (float)Math.Round(rateHeight, 2);
            }

            using (GraphicsPath path = GetShapePath(rect))
            {
                gr.SetClip(path);
                gr.FillRectangle(_activeNoteBarBrush.GetBrush(Rectangle.Round(rect)), new RectangleF(rect.Left, rect.Bottom - rateHeight, rect.Width, rateHeight));
                gr.ResetClip();
            }
        }
Ejemplo n.º 2
0
        private void DrawBackGround(Graphics gr)
        {
            if (BackgroundImage != null)
            {
                return;
            }

            gr.FillRectangle(_backGroundBrush.GetBrush(ClientRectangle), ClientRectangle);
        }
Ejemplo n.º 3
0
        private void DrawRowLines(Graphics gr, Rectangle clientRect)
        {
            if (_rowLineWidth <= 0)
            {
                return;
            }

            for (int i = 1; i < _ratings.Count; ++i)
            {
                RectangleF rect = new RectangleF(clientRect.Left, clientRect.Top + i * _rowHeight + (i - 1) * _rowLineWidth, clientRect.Width, _rowLineWidth);
                gr.FillRectangle(_rowLineBrush.GetBrush(Rectangle.Round(rect)), rect);
            }
        }
Ejemplo n.º 4
0
        private void DrawNoteBar(Graphics gr, BrushInfo brushInfo, Color frameColor, RectangleF rect)
        {
            rect.Inflate(_noteBarShapeInflateValue, _noteBarShapeInflateValue);

            if (frameColor != Color.Empty)
            {
                using (GraphicsPath framePath = GetShapePath(rect))
                {
                    gr.FillPath(new SolidBrush(frameColor), framePath);
                }

                rect.Inflate(-1, -1);
            }

            using (GraphicsPath path = GetShapePath(rect))
            {
                gr.FillPath(brushInfo.GetBrush(Rectangle.Round(rect)), path);
            }
        }