CRichEditCtrl::FormatRange

Rich edit 컨트롤을 특정 장치에 대 한 텍스트 서식을 지정합니다.

long FormatRange(
   FORMATRANGE* pfr,
   BOOL bDisplay = TRUE 
);

매개 변수

  • pfr
    포인터는 FORMATRANGE 출력 장치에 대 한 정보를 포함 하는 구조입니다.NULL rich edit 컨트롤에서 캐시 된 정보를 확보할 수 있는 것을 나타냅니다.

  • bDisplay
    텍스트를 렌더링할지 여부를 나타냅니다.경우 거짓, 방금 텍스트를 측정 합니다.

반환 값

+ 1의 지역에 맞는 마지막 문자의 인덱스입니다.

설명

일반적으로이 호출이 호출 하 여 뒤 DisplayBand.

자세한 내용은 EM_FORMATRANGE 메시지와 FORMATRANGE 의 구조는 Windows SDK.

예제

// First obtain a pointer to a printer DC.
CPageSetupDialog psDlg;
if (IDOK == psDlg.DoModal())
{
   CDC* pMyPrinterDC = CDC::FromHandle(psDlg.CreatePrinterDC());

   FORMATRANGE fr;

   // Get the page width and height from the printer.
   long lPageWidth = ::MulDiv(pMyPrinterDC->GetDeviceCaps(PHYSICALWIDTH),
       1440, pMyPrinterDC->GetDeviceCaps(LOGPIXELSX));
   long lPageHeight = ::MulDiv(pMyPrinterDC->GetDeviceCaps(PHYSICALHEIGHT),
       1440, pMyPrinterDC->GetDeviceCaps(LOGPIXELSY));
   CRect rcPage(0, 0, lPageWidth, lPageHeight);

   // Format the text and render it to the printer.
   fr.hdc = pMyPrinterDC->m_hDC;
   fr.hdcTarget = pMyPrinterDC->m_hDC;
   fr.rc = rcPage;
   fr.rcPage = rcPage;
   fr.chrg.cpMin = 0;
   fr.chrg.cpMax = -1;
   m_myRichEditCtrl.FormatRange(&fr, TRUE);

   // Update the display with the new formatting.
   RECT rcClient;
   m_myRichEditCtrl.GetClientRect(&rcClient);
   m_myRichEditCtrl.DisplayBand(&rcClient);   

   pMyPrinterDC->DeleteDC();
}

요구 사항

헤더: afxcmn.h

참고 항목

참조

CRichEditCtrl 클래스

계층 구조 차트

CRichEditCtrl::DisplayBand