简体   繁体   English

如何修改TextBox控件选项卡停止

[英]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.

相关问题 如何获取AjaxFileUpload控件以查看表单上的文本框中的内容 - How do you get a AjaxFileUpload control to see what is in a textbox on a form 如何在WinForms选项卡控件中指出要从哪个选项卡移动到哪个选项卡? - How do I tell which tab you are moving from/to in a WinForms tab control? 您如何修改已重新父到TabPage的控件? - How do you modify a control that has been re-parented to a TabPage? 如何为发送到移动设备的垂直居中消息创建WYSIWYG TextBox控件编辑器? - How do you create a WYSIWYG TextBox control editor for vertically centered messages sent to a mobile device? 如何修改文本框控件,以便按退格键删除整个单词,而不是一次删除一个字符? - How do I modify a textbox control so that pressing backspace deletes whole words instead of just one character at a time? 在C#GUI程序中,如何在单击对象时将选项卡控件移到最前面? - In a C# GUI program how do you move a tab control to the front on the click of an object? 如何使选项卡控件看起来像在 Visual Studio 中一样 - How do you make a tab control look like it does in Visual Studio 在拉伸的标签控件中居中文本框 - Center textbox in a stretched tab control 如何修改所选选项卡中的控件 - C# - How can I modify a control in the selected tab - C# 如何从另一个选项卡访问Winform文本框控件? - How to access winform textbox control from another tab?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM