CEditView::SetTabStops

디스플레이 및 인쇄에 사용 되는 탭 정지를 설정 하려면이 함수를 호출 합니다.

void SetTabStops(
   int nTabStops 
);

매개 변수

  • nTabStops
    장치 대화 상자에서에서 각 탭의 너비입니다.

설명

탭 너비만 지원 됩니다.(CEdit 탭 너비 여러 개체를 지원 합니다.) 같음 (대 / 소문자 알파벳 문자에 대해서만 기준) 인쇄 하거나 표시할 때 사용 되는 글꼴의 평균 문자 너비의 1 / 4 대화 단위 너비입니다.사용해 서는 안됩니다 CEdit::SetTabStops 때문에 CEditView 탭 값을 캐시 합니다.

이 함수는 호출 개체의 탭만 수정 합니다.탭을 변경 하려면 각각에 대해 중지 CEditView 개체에서 응용 프로그램을 호출 각 개체의 SetTabStops 함수입니다.

예제

다음 코드 조각 탭 정지 마다 네 번째 문자를 컨트롤에 컨트롤을 사용 하 여 글꼴을 신중 하 게 측정 하 여 설정 합니다.

// gain a reference to the edit control
CEdit& theEdit = GetEditCtrl();

// get the font the control is using
CFont* pFont = theEdit.GetFont();
TEXTMETRIC tm;

// get the control's DC, too
CDC* pDC = theEdit.GetDC();

// Select the font that the control uses by default into the DC.
// We must do this because the control may or may not be using
// that font at this exact moment
CFont* pOldFont = pDC->SelectObject(pFont);

// Retrieve text metrics for that font and return the previously
// selected font.
pDC->GetTextMetrics(&tm);
pDC->SelectObject(pOldFont);

// Get an identity rectangle and map it to dialog units
CRect rect(0, 0, 100, 1);
::MapDialogRect((HWND)this, rect);

// We now know that 100 dialog units are rect.Width() screen units,
// so we can multiply screen units by 100 and divide by rect.Width()
// to find dialog units from screen units. tm.tmAveCharWidth is
// the width of _one_ character, so setting the tabs at every
// four characters means we also multiply by four.
SetTabStops((4 * tm.tmAveCharWidth * 100) / rect.Width());

요구 사항

헤더: afxext.h

참고 항목

참조

CEditView 클래스

계층 구조 차트

시작

CEditView::SetPrinterFont