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 ich beim CFontDialog die Schriftart vorbelegen kann,

so dass, wenn der dialog aufgerufen wird z.B. 'Courier New' vorgegeben ist,

jedoch eine andere schrift ausgewählt werden kann.

so, folgendes mach ich in der MyDoc.cpp


m_pFont = new CFont();

LPCTSTR FontFace;

FontFace = "Courier New";

m_pFont->CreateFont(

0,

0,

0,

0,

0,

0,

0, 

0,

DEFAULT_CHARSET,

OUT_DEFAULT_PRECIS,

CLIP_DEFAULT_PRECIS,

DEFAULT_QUALITY,

DEFAULT_PITCH,

FontFace);

desweiteren gibt es noch eine funktion OnFont():

void CWrdiffDoc::OnFont() 

{

CFontDialog dlg;

dlg.DoModal();


m_pFont->DeleteObject();

m_pFont->CreateFont(

dlg.GetSize() / 5,

0,

0,

0,

dlg.GetWeight(),

dlg.IsItalic(),

0,//dlg.IsUnderline(), 

0,//dlg.IsStrikeOut(),

DEFAULT_CHARSET,

OUT_DEFAULT_PRECIS,

CLIP_DEFAULT_PRECIS,

DEFAULT_QUALITY,

DEFAULT_PITCH,

dlg.GetFaceName() );


UpdateAllViews(NULL);

}

wenn ich nun die funktion 'OnFont()' aufrufe, soll der CFontDialog Gezeigt werden

und der 'LPCTSTR FontFace;' soll als vorgegebene Schriftart im Dialog erscheinen.

Ciao TinTin

PS: eventuell weiss auch noch jemand, wie ich die auswahl der schriftarten auf

'nicht-proportionale' wie z.b. 'Fixedsys', 'Courier New' usw. beschränke...

LOGFONT lf;
m_pFont->GetLogFont( &lf );
CFontDialog dlg;
dlg.m_cf.lpLogFont = &lf;
dlg.m_cf.Flags |= CF_FIXEDPITCHONLY | CF_INITTOLOGFONTSTRUCT ;
dlg.DoModal();
[/CODE]

CFontDialog enthält eine CHOOSEFONT-Struktur (m_cf), die wiederum einen Zeiger auf eine LOGFONT-Struktur enthält. Aus deinem CFont kannst du dir eine solche Struktur füllen lassen (GetLogFont).

Über die Flags wird das Verhalten des Dialogs gesteuert. CF_FIXEDPITCHONLY bedeutet, dass nur Festbreitenschriftarten angezeit werden, CF_INITTOLOGFONTSTRUCT bedeutet, dass der Dialog mit den Daten aus der LOGFONT-Struktur initialisiert wird.

Es gibt noch weitere nützliche Flags, die du in der MSDN unter CHOOSEFONT Structure finden kannst.

:uli

oh klotzkopp,

ohne dich wäre meine welt noch um einige ungeklärte fragen reicher.

danke für die ausführliche auskunft.

:e@sy

cioa TinTin

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.