Fix for WordWrap in CheckBox.cs

Nov 10, 2009 at 3:39 AM
Edited Nov 10, 2009 at 3:54 AM

Found an issue with Checkbox class: Wordwrap property has no effect (text is printed in 1 line despite being longer).

The fix:

@ CheckBox.cs

        protected override void OnLayout()
        {
            InvalidateCheckBox();
            checkBoxImage.Location = Control.ScaledPoint(0, (Height - checkBoxImage.Height) / 2);
            int w = checkBoxImage.Width + 3;            
            if (CheckFlag(InvalidationFlag.Size | InvalidationFlag.Margin))
            {
                stringVisual.Bounds = new Rectangle(w, stringVisual.Bounds.Y, stringVisual.Bounds.Width, stringVisual.Bounds.Height);
                stringVisual.Size = Size;
            } 
            base.OnLayout();
        }

My 2 cents :)