CRichEditCtrl::SetTargetDevice

设置用于WYSIWYG的目标设备和线条宽度("所见即所得获得)格式化 CRichEditCtrl 对象。

BOOL SetTargetDevice(
   HDC hDC,
   long lLineWidth 
);
BOOL SetTargetDevice(
   CDC& dc,
   long lLineWidth 
);

参数

  • hDC
    与设备上下文的处理新的目标设备的。

  • lLineWidth
    使用的线条宽度格式设置。

  • dc
    新的目标设备的CDC

返回值

非零,如果成功;否则,0。

备注

如果此功能成功,rich edit控件拥有作为参数传递的设备上下文。 在这种情况下,调用函数不应销毁设备上下文。

有关更多信息,请参见 Windows SDK的 EM_SETTARGETDEVICE

示例

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

   // Get line width information from the printer.
   long lLineWidth = ::MulDiv(pMyPrinterDC->GetDeviceCaps(PHYSICALWIDTH),
       1440, pMyPrinterDC->GetDeviceCaps(LOGPIXELSX));

   // Set the printer as the target device.
   m_myRichEditCtrl.SetTargetDevice(*pMyPrinterDC, lLineWidth);   

   pMyPrinterDC->DeleteDC();
}

要求

Header: afxcmn.h

请参见

参考

CRichEditCtrl选件类

层次结构图

CRichEditCtrl::FormatRange

CRichEditCtrl::DisplayBand