Click here to Skip to main content
16,015,900 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProblem to use StrRetToBuf function Pin
24-May-02 22:19
suss24-May-02 22:19 
GeneralWindow, transparent for mouse clicks Pin
Alex Cramer24-May-02 21:34
Alex Cramer24-May-02 21:34 
GeneralRe: Window, transparent for mouse clicks Pin
Renjith Ramachandran25-May-02 4:04
Renjith Ramachandran25-May-02 4:04 
GeneralPuzzled when converting CInternetFile* to FILE* Pin
George Ma24-May-02 19:37
George Ma24-May-02 19:37 
GeneralRe: Puzzled when converting CInternetFile* to FILE* Pin
Nish Nishant24-May-02 19:55
sitebuilderNish Nishant24-May-02 19:55 
GeneralRe: Puzzled when converting CInternetFile* to FILE* Pin
Erik Funkenbusch25-May-02 3:29
Erik Funkenbusch25-May-02 3:29 
GeneralRe: Puzzled when converting CInternetFile* to FILE* Pin
George Ma25-May-02 17:07
George Ma25-May-02 17:07 
GeneralCFontDialog and LOGFONT :: MFC Pin
valikac24-May-02 17:52
valikac24-May-02 17:52 
Hi.

I have a question about the use of LOGFONT with CFontDialog. I would like to have an option to change the font including size, weight, etc. I implemented a feature with CFontDialog support. I pass a pointer to a LOGFONT object when I instantiate the CFontDialog. Upon DoModal() == IDOK, I create a new LOGFONT object and assign it the value from CFontDialog. The program works sometimes. I am experiencing some weird reactions. First, the size of the font rarely comes out correctly. The size seems to be 10x *smaller* than the actual size of whatever the user selects from CFontDialog. Vice versa, when CFontDialog first starts up, I am able to pass it a LOGFONT of the current font. Again, it reads and interprets the font size incorrectly. For example, all default font size is 110 (11 points). However, when CFontDialog starts up, it interprets 110 as 83.

Here is a concise example.

-----
LOGFONT *mLFont = new LOGFONT;
memset(mLFont, 0, sizeof(LOGFONT);
mLFont->lfHeight = 110;
strcpy(mLFont->lfFaceName, "Microsoft Sans Serif");
CFont *myFont = new CFont;
myFont->CreatePointFontIndirect(mLFont);

// Everything is good up to this point.

CFontDialog myFDlg(mLFont);

if (myFDlg.DoModal() == IDOK)
{

// I am not sure if I need to create a new (clean) LOGFONT object

if (mLFont != NULL)
{
delete mLFont;
mLFont = NULL;
}

mLFont = new LOGFONT;
memset(mLFont, 0, sizeof(LOGFONT));
myFDlg.GetCurrentFont(mLFont);
}
-----

Okay. For some reason, the actual font that GetCurrentFont(...) passes back is 10x smaller than the actual size or the size that the user actually thought it want it to be

I am using CEditView. I use GetEditCtrl().SetFont() to set the font. I use GetEditCtrl().SetWindowText(...) to set the text.

I mentioned about deleting a LOGFONT object and allocating a new object each time I make a change to an LOGFONT object. Is that necessary?

Thanks,
Kuphryn
GeneralRe: CFontDialog and LOGFONT :: MFC Pin
Jason Henderson24-May-02 18:46
Jason Henderson24-May-02 18:46 
GeneralRe: CFontDialog and LOGFONT :: MFC Pin
valikac25-May-02 5:58
valikac25-May-02 5:58 
Generalavi software Pin
pnpfriend24-May-02 13:52
pnpfriend24-May-02 13:52 
GeneralRe: avi software Pin
Rama Krishna Vavilala24-May-02 16:26
Rama Krishna Vavilala24-May-02 16:26 
GeneralRe: avi software Pin
Nish Nishant24-May-02 17:43
sitebuilderNish Nishant24-May-02 17:43 
GeneralRe: avi software Pin
pnpfriend25-May-02 2:52
pnpfriend25-May-02 2:52 
GeneralRe: avi software Pin
Maxwell Chen25-May-02 9:03
Maxwell Chen25-May-02 9:03 
GeneralRe: avi software Pin
Mike Nordell25-May-02 14:11
Mike Nordell25-May-02 14:11 
Generalwant to post .gif file on my dialog. Pin
pnpfriend24-May-02 12:04
pnpfriend24-May-02 12:04 
GeneralRe: want to post .gif file on my dialog. Pin
Shog924-May-02 12:20
sitebuilderShog924-May-02 12:20 
GeneralRe: want to post .gif file on my dialog. Pin
25-May-02 0:14
suss25-May-02 0:14 
GeneralRe: want to post .gif file on my dialog. Pin
pnpfriend25-May-02 4:40
pnpfriend25-May-02 4:40 
GeneralRe: want to post .gif file on my dialog. Pin
devvvy28-Oct-02 11:23
devvvy28-Oct-02 11:23 
GeneralWin2000 Vs. XP Pin
pnpfriend24-May-02 10:45
pnpfriend24-May-02 10:45 
GeneralWSAGetLastError oddity in VC7 Pin
Clinton James24-May-02 10:47
Clinton James24-May-02 10:47 
GeneralRe: WSAGetLastError oddity in VC7 Pin
Mike Nordell24-May-02 16:16
Mike Nordell24-May-02 16:16 
GeneralRe: WSAGetLastError oddity in VC7 Pin
Clinton James28-May-02 4:34
Clinton James28-May-02 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.