C#을 사용하면 멀티 라인 텍스트 상자에서 탭 위치를 어떻게 설정합니까?

StackOverflow https://stackoverflow.com/questions/2000772

문제

C#의 멀티 라인 텍스트 상자에 사용자 정의 탭 크기/위치를 설정하는 우아한 방법이 있습니까?

도움이 되었습니까?

해결책

당신은 그것을 보내야합니다 EM_SETTABSTOPS 다음과 같은 메시지 :

static class NativeMethods {
    [DllImport("user32.dll")]
    public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, ref int lParam);
}
static void SetTabs(TextBox box) {
    //EM_SETTABSTOPS - http://msdn.microsoft.com/en-us/library/bb761663%28VS.85%29.aspx
    int lParam = 16;  //Set tab size to 4 spaces
    NativeMethods.SendMessage(box.Handle, 0x00CB, new IntPtr(1), ref lParam);
    box.Invalidate();
}

다른 팁

VB 2013 외에도 Microsoft의 친절한 사람들은 더 이상 Windows 핸들이 필요하지 않다고 결정했으며 더 이상 얻을 수 없습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top