private GraphicsPath GetHandlePath(HandleSizes handleSizes) { GraphicsPath path = new GraphicsPath(); // create path path.AddArc(handleSizes.LeftMargin, handleSizes.TopMargin, handleSizes.HandleWidth, handleSizes.DomeHeight, 180, 180); // Top path.AddArc(handleSizes.RightMargin, handleSizes.MiddleHeight + handleSizes.DomeHeight - 1 - handleSizes.TopMargin, handleSizes.HandleWidth, handleSizes.DomeHeight, 360, 180); //Bottom path.CloseAllFigures(); return(path); }
public void PaintHandle(PaintEventArgs e, Color thumbColor, HandleSizes handleSizes) { //Set Graphics smoothing mode to Anit-Alias-- e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; // Draw handle using (GraphicsPath graphPath = GetHandlePath(handleSizes)) { //this.Region = new Region(graphPath); using (Pen pen = new Pen(thumbColor, 0.25f)) { pen.Alignment = PenAlignment.Inset; e.Graphics.DrawPath(pen, graphPath); // Fill path with color using (Brush brush = new SolidBrush(thumbColor)) { e.Graphics.FillPath(brush, graphPath); } } } }