Exemple #1
0
        private void DrawHandles(PaintEventArgs e, BrightnessSelectorHandle handle)
        {
            var range1Rect = handle.GetHandleRangeRectangle(ClientRectangle, HalfHandleSizeX / 2, HalfHandleSizeY / 2, true,
                                                            PerBulb ? handle.HandleNumber : 1, HandleCount, handle.HandleNumber);

            var r1Centre = new System.Drawing.Point(range1Rect.X + range1Rect.Width / 2, range1Rect.Y);

            var range2Rect = handle.GetHandleRangeRectangle(ClientRectangle, HalfHandleSizeX / 2, HalfHandleSizeY / 2, false,
                                                            PerBulb ? handle.HandleNumber : 1, HandleCount, handle.HandleNumber);

            var r2Centre = new System.Drawing.Point(range2Rect.X + range2Rect.Width / 2, range2Rect.Y + range1Rect.Height);

            e.Graphics.DrawLine(Pens.Black, r1Centre, r2Centre);

            var handleBrush = new SolidBrush(Color.FromArgb(224, 128, 128, 255));

            DrawHandle(e, handle, false, handleBrush, range1Rect);
            DrawHandle(e, handle, false, handleBrush, range2Rect);

            handleBrush = new SolidBrush(Color.FromArgb(224, 128, 255, 128));

            DrawHandle(e, handle, true, handleBrush,
                       handle.GetHandleRectangle(ClientRectangle, HalfHandleSizeX, HalfHandleSizeY,
                                                 PerBulb ? handle.HandleNumber : 1, HandleCount, handle.HandleNumber));
        }
Exemple #2
0
        private void DrawHandle(PaintEventArgs e, BrightnessSelectorHandle handle, bool label, SolidBrush handleBrush,
                                Rectangle handleRect)
        {
            e.Graphics.FillEllipse(handleBrush, handleRect);
            e.Graphics.DrawEllipse(Pens.Black, handleRect);

            if (label)
            {
                using (var font1 = new Font("Segoe UI", ClientRectangle.Width / 12, System.Drawing.FontStyle.Bold, GraphicsUnit.Point))
                {
                    var stringFormat = new StringFormat
                    {
                        Alignment     = StringAlignment.Center,
                        LineAlignment = StringAlignment.Center
                    };
                    e.Graphics.DrawString(handle.HandleNumber.ToString(), font1, Brushes.White, handleRect, stringFormat);
                }
            }
        }