Skip to content

RichTextBox does not repaint border on resize and does not support custom BackColor #40

Description

@marius-klimantavicius

Platform windows.

Steps to reproduce:

  1. Enable visual styles
  2. Add a RichTextBox with Dock = Fill, set BackColor to some value
  3. Run app
  4. Resize the form - grow

Expected behavior:

  1. After resizing the control is rendered correctly (border is fully rendered and back color is the one that was set via BackColor)

Actual result:

  1. After form has grown part of the RichTextBox border is missing
  2. BackColor is default color

Fixes:

  1. I added XplatUI.SendMessage(Handle, Msg.WM_NCPAINT, IntPtr.Zero, IntPtr.Zero); to TextBoxBase.SetBoundsCore (maybe SetStyle(ControlStyles.ResizeRedraw, true) would suffice but I haven't tested that)
  2. Updated ThemeVisualStyles.TextBoxBaseFillBackground to use base.TextBoxBaseFillBackground (textBoxBase, g, clippingArea) if back color is set:
if (!RenderClientAreas ||
		    !TextBoxBaseShouldPaint (textBoxBase) ||
		    textBoxBase.backcolor_set // <-- THIS condition
		    ) {
			base.TextBoxBaseFillBackground (textBoxBase, g, clippingArea);
			return;
		}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions