2008-09-09 2 views
1

Windows Forms TextBox를 사용할 때 기본 탭 멈춤 (공백) 수는 8입니다. 어떻게 수정합니까?TextBox 컨트롤 탭 멈춤을 수정하는 방법

+0

잘 작동, 대화 템플리트 단위 (대화 형식 템플릿 단위)에서 측정 된 값을 말하는 것을 잊었습니다. 'int [] = {16}'내 폰트로 4 개의 공백의 탭을줍니다. –

답변

4

먼저 다음 클래스 선언 한 후 다음을 추가 다음 네임 스페이스

using System.Runtime.InteropServices; 

을 추가

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); 

그런 다음 추가 Form_Load 이벤트에 다음

// define value of the Tab indent 
int[] stops = {16}; 
// change the indent 
SendMessage(this.textBox1.Handle, EM_SETTABSTOPS, 1, stops);