Search code examples
c#winformsnumericupdown

Redraw issue with NumericUpDown


Hi I have a weird redraw issue with the NumericUpDown control. If I have another control at the same location and set its Visible property to false and the Visible property of the NumericUpDown to true the NumericUpDown appears without a border and parts of the other control are visible in the background (even if its Visible property is false). Even a call to Refresh of the NumericUpDown or the parent container won't change anything. If the control that is in the background is a TextBox the NumericUpDown appears correctly but I assume this is the case cause the border is equal and therefore it only looks like it's drawn correctly.

Is this a bug of the NumericUpDown control? How can I fix it?

Thanks for help.

Edit: Here is a screenshot. I simply change the visible properties of the ComboBox and the NumericUpDown dependent of the Checked properties of the RadioButtons.

enter image description here


Solution

  • I finally found the problem. I used an overlay control from CodeProject which allows me to draw primitives over my entire form. Despite the fact I only use it rarely it will still change the way child controls are painted. While other controls work fine, the NumericUpDown seems to have some problems with it.

    Maybe someone will have the same issue in the future. Therefore here is the link to the CodeProject project I use: http://www.codeproject.com/Articles/26071/Draw-Over-WinForms-Controls.