How to set the TAB width in a Windows Forms TextBox control?

前端 未结 6 511
独厮守ぢ
独厮守ぢ 2020-12-17 08:57

Given a WinForms TextBox control with MultiLine = true and AcceptsTab == true, how can I set the width of the tab character displayed?

I wa

6条回答
  •  余生分开走
    2020-12-17 09:41

    I know you are using a TextBox currently, but if you can get away with using a RichTextBox instead, then you can use the SelectedTabs property to set the desired tab width:

    richTextBox.SelectionTabs = new int[] { 15, 30, 45, 60, 75};
    

    Note that these offsets are pixels, not characters.

提交回复
热议问题