using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace ServerExplorer.Controls { [ComVisible(true)] [ClassInterface(ClassInterfaceType.AutoDispatch)] public class CustomTextBox : TextBox { #region SetTabWidth private const int EM_SETTABSTOPS = 0x00CB; [DllImport("User32.dll", CharSet = CharSet.Auto)] private static extern IntPtr SendMessage(IntPtr h, int msg, int wParam, int[] lParam); public void SetTabWidth(int tabWidth) { SendMessage(this.Handle, EM_SETTABSTOPS, 1, new int[] { tabWidth * 4 }); } #endregion private int _tabWidth=8; public int TabWidth { get { return _tabWidth; } set { _tabWidth = value; SetTabWidth(value); } } } }