[英]How do you Modify TextBox Control Tab Stops
使用Windows窗体TextBox时,默认的制表位(空格)数为8.如何修改?
First add the following namespace 首先添加以下命名空间
using System.Runtime.InteropServices;
Then add the following after the class declaration: 然后在类声明后添加以下内容:
private const int EM_SETTABSTOPS = 0x00CB;
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr h,
int msg,
int wParam,
int [] lParam);
Then add the following to the Form_Load event: 然后将以下内容添加到Form_Load事件:
// define value of the Tab indent
int[] stops = {16};
// change the indent
SendMessage(this.textBox1.Handle, EM_SETTABSTOPS, 1, stops);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.