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.

Empfohlene Antworten

Veröffentlicht

Hi,

kann mir jemand sagen, wie man in einem RichEdit die Schriftfarbe ändern kann?

Die Farbe, in die gewechselt werden soll ist in einer Variable vom Typ COLORREF gespeichert.

mfg

$nPrCrZ

Du selektierst den zu ändernden Text, und verschickst EM_SETCHARFORMAT (bzw. rufst CRichEditCtrl::SetSelectionCharFormat auf, falls Du die MFC verwendest). In der CHARFORMAT-Struktur, die als Parameter übergeben wird, gibt es einen COLORREF-Member namens crTextColor.

Hat nicht funktioniert. Mein Code:

/*********************************************/

UpdateData();

CHARFORMAT charformat;

m_RichEditCtrl.SetSel(2, 12);

m_RichEditCtrl.GetSelectionCharFormat(charformat);

charformat.crTextColor = FontDialog.GetColor();

m_RichEditCtrl.SetSelectionCharFormat(charformat);

UpdateData(FALSE);

/*********************************************/

was mache ich falsch?

Entweder ist das Flag CFM_COLOR in dwMask nicht gesetzt, oder das Flag CFE_AUTOCOLOR in dwEffects ist gesetzt.

Versuch mal das hier:

CHARFORMAT charformat;

m_RichEditCtrl.SetSel(2, 12);
m_RichEditCtrl.GetSelectionCharFormat(charformat);
charformat.crTextColor = FontDialog.GetColor();
[color=darkred]charformat.dwMask |= CFM_COLOR;
charformat.dwEffects &= ~CFE_AUTOCOLOR;[/color]
m_RichEditCtrl.SetSelectionCharFormat(charformat);[/CODE]

So gehts. Danke.

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.