Rich Text Box padding between text and border

前端 未结 11 2148
我在风中等你
我在风中等你 2021-02-02 10:48

Is it possible to add padding into a Rich Text Box control between the text and the border?

I tried docking a rich text box inside of a panel, with its padding for all f

11条回答
  •  清歌不尽
    2021-02-02 10:56

    I had this same problem and the answer described didn't help me, this worked for me so i'll share it if it helps.

    richTextBox1.SelectAll();
    richTextBox1.SelectionIndent += 15;//play with this values to match yours
    richTextBox1.SelectionRightIndent += 15;//this too
    richTextBox1.SelectionLength = 0;
    //this is a little hack because without this
    //i've got the first line of my richTB selected anyway.
    richTextBox1.SelectionBackColor = richTextBox1.BackColor;
    

提交回复
热议问题