Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Höhe und Breite von Richedittext ermitteln?

Empfohlene Antworten

Veröffentlicht

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,

kaldemor

Hab mit dem Beispiel aus MSDN versucht -> Programmabsturz.
Ohne mir das jetzt genauer angesehen zu haben: Solange du mit uninitialiserten Zeigern hantierst, darf dich das nicht wundern. Es wäre also gut, wenn pmyRichEditCtrl und pMyPrinterDC auch tatsächlich auf etwas zeigen würden, und nicht nur irgendwo in den Speicher.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.