Compartir a través de


CEditView::SetTabStops

Llame a esta función para establecer las tabulaciones utilizadas para la presentación y la impresión.

void SetTabStops(
   int nTabStops 
);

Parámetros

  • nTabStops
    Ancho de cada tabulación, en unidades de cuadro de diálogo.

Comentarios

Sólo se admite un solo ancho de la interrupción de tabulación.(los objetos deCEdit admiten anchos varios de la ficha.) Los anchos se en unidades de cuadro de diálogo, que igualan un cuarto de ancho de caracteres medio (basado en mayúsculas y caracteres alfabéticos en minúsculas solo) de la fuente utilizada en el momento de impresión o para mostrar.No debe utilizar CEdit::SetTabStops porque CEditView debe almacenar en memoria caché el valor de la interrupción de tabulación.

Esta función modificar únicamente las fichas del objeto para el que se llama.Para cambiar las tabulaciones para cada objeto de CEditView en la aplicación, llame a la función de SetTabStops de cada objeto.

Ejemplo

Este fragmento de código establecen tabulaciones en el control a cada cuarto carácter cuidadosamente medir la fuente que utiliza el control.

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

Requisitos

encabezado: afxext.h

Vea también

Referencia

Clase CEditView

Gráfico de jerarquía

CWnd::SetFont

CEditView::SetPrinterFont