Click here to Skip to main content
11,932,446 members (54,519 online)
Rate this:
Please Sign up or sign in to vote.
See more: MFC font
first of all sorry for my bad english.
im trying to change font of a CEdit Control using of Setfont() function but its not working for me here is my code:
void CCustomView::OnInitialUpdate(){
CFont font;
CmyEdit* myEdit = new CmyEdit;
myEdit->Create( WS_CHILD|WS_VISIBLE,GetCurrentNodeRect(),this,1);

myEdit->SetFont( &font );

CCustom View is a CView subclass.

im so fresh in mfc.plz explain in details.

best regards
Posted 2-Dec-12 1:07am
Edited 2-Dec-12 1:11am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

An object will be destoried after it works down. So you should use a point of object.

CFont *m_pFont = new CFont;
d rasool 2-Dec-12 7:06am
Thanks alot. this is working now.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 2 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100