Announcement

Collapse
No announcement yet.

Höhe und Breite von Richedittext ermitteln?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Höhe und Breite von Richedittext ermitteln?

    Hallo,

    wie kann man Höhe und Breite von einem Richedittext ermitteln?
    Hab mit dem Beispiel aus MSDN versucht -> Programmabsturz.

    // The pointer to my rich edit control.
    CRichEditCtrl* pmyRichEditCtrl;
    // A pointer to a printer DC.
    CDC* pMyPrinterDC;

    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;
    pmyRichEditCtrl->FormatRange(&fr, TRUE);

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


    Hat jemand eine andere Idee?

    Mfg,
    tocha

  • #2
    // The pointer to my rich edit control.
    CRichEditCtrl* pmyRichEditCtrl;
    // A pointer to a printer DC.
    CDC* pMyPrinterDC;

    wo sind die initialisierungen der zeiger ?

    mfg
    Fred

    Comment

    Working...
    X