protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); var handleRectangleRadius = HandleHeight / 4; var textRectangleRadius = HandleHeight / 2; valueLabel.Text = $"{_value.ToString("F1")}{AdditionalText}"; valueLabel.Location = new Point(HandleWidth + textRectangleRadius, 1); valueLabel.Size = new Size(Width - HandleWidth - 2 * textRectangleRadius, Height - 2); var handleRectangle = new RectangleF(0, Height / 2.0F - HandleHeight / 2.0F, HandleWidth, HandleHeight); var textRectangle = new Rectangle(HandleWidth, 0, Width - HandleWidth, Height); var handlePath = GraphicsUtilities.CreateRoundedRectanglePath(handleRectangle, handleRectangleRadius); var textPath = GraphicsUtilities.CreateRoundedRectanglePath(textRectangle, textRectangleRadius); var graphics = e.Graphics; graphics.SmoothingMode = SmoothingMode.AntiAlias; using (var brush = new SolidBrush(BackColor)) { graphics.FillPath(brush, handlePath); graphics.FillPath(brush, textPath); } using (var pen = new Pen(BorderColor)) { graphics.DrawPath(pen, handlePath); graphics.DrawPath(pen, textPath); } using (var brush = new SolidBrush(BackColor)) { var rect = handleRectangle; rect.Inflate(2, -1); rect.X += 3; graphics.FillRectangle(brush, rect); } var region = GraphicsUtilities.GetRegionForPath(handlePath); region.Union(GraphicsUtilities.GetRegionForPath(textPath)); Region = region; }