From: David Wilkinson on
Arpit wrote:

>
> i do not get any effect of setfont. here is my code for that:-
>
> ***********************************************************************************************
> //my rect area of editbox
> CRect
> rectEdit(m_stShape[nIEdited][nJEdited].pointTopLeft.x-m_nWidthOffset+1,m_stShape[nIEdited][nJEdited].pointTopLeft.y-m_nHeightOffset+1,m_stShape[nIEdited][nJEdited].pointBottomRight.x-m_nWidthOffset-1,m_stShape[nIEdited][nJEdited].pointBottomRight.y-m_nHeightOffset-1);
>
> m_editCell.Create(ES_LEFT | WS_VISIBLE |
> ES_AUTOVSCROLL,rectEdit,this,1);
> m_editCell.SetLimitText(50); // limit the text that can be entered
> m_editCell.SetFocus(); // set the focus in edit box
>
> CFont fontEdit; // font while typing
> fontEdit.CreateFont(17,0,0,0,FW_REGULAR,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH
> | FF_SWISS,"Calibri");
>
> m_editCell.SetFont(&fontEdit);
> ************************************************************************************************

Arpit:

Your font object is going out of scope. Make it a member variable.

David Wilkinson
From: Tom Serface on
You may want to try making the CFont a member of your class roather than
having it in a function. The font won't work if it goes out of scope.

Tom

"Arpit" <arpitpmehta(a)gmail.com> wrote in message
news:1157090861.349694.243440(a)h48g2000cwc.googlegroups.com...
>> To get rid of bold font, you should change the font to whatever you
>> want(use
>> SetFont).
>
> QUESTION
> ---------------
>
> i do not get any effect of setfont. here is my code for that:-
>
> ***********************************************************************************************
> //my rect area of editbox
> CRect
> rectEdit(m_stShape[nIEdited][nJEdited].pointTopLeft.x-m_nWidthOffset+1,m_stShape[nIEdited][nJEdited].pointTopLeft.y-m_nHeightOffset+1,m_stShape[nIEdited][nJEdited].pointBottomRight.x-m_nWidthOffset-1,m_stShape[nIEdited][nJEdited].pointBottomRight.y-m_nHeightOffset-1);
>
> m_editCell.Create(ES_LEFT | WS_VISIBLE |
> ES_AUTOVSCROLL,rectEdit,this,1);
> m_editCell.SetLimitText(50); // limit the text that can be entered
> m_editCell.SetFocus(); // set the focus in edit box
>
> CFont fontEdit; // font while typing
> fontEdit.CreateFont(17,0,0,0,FW_REGULAR,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH
> | FF_SWISS,"Calibri");
>
> m_editCell.SetFont(&fontEdit);
> ************************************************************************************************
> Is it that i have to use some another flag instead of FW_REGULAR for
> not getting BOLD characters
>
> ####################################################################
>
>>For sizing the control, you can use SetWindowPos.
>
> QUESTION
> ----------------
> Yes, but my problem i dont seem to be finding how can i come to know
> that text has reached the limit of editbox size.
>
> Thanks for replying..
>


From: Joseph M. Newcomer on
If you have not explicitly done a SetFont, a dynamically-created control will get the
system font, which is not just bold, but quite different in a lot of ways from most fonts.
Typically, you will want to set the font of the edit control to the font you desire.

I believe there is a codeproject example that has a dynamically-resizing edit control.
joe

On 31 Aug 2006 06:51:46 -0700, "Arpit" <arpitpmehta(a)gmail.com> wrote:

>Hi experts,
>I m preparing Excel kind of thing using SDI application.
>
>I m using CEdit object for entering text. I have kept the size of CEdit
>as the size of my cell(D5 etc..) What i see is that inside my edit Box
>the text are displayed in bold letters. I dont want this. Moreever
>after reaching the limit of edit box i should dynamically increase the
>edit box's size while typing, as needed. See Microsoft Office Excel
>2007 (Beta) for further checking.. Can any one of u guide me to how to
>do this????
>Thanks
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Arpit on
Thanks .. I have to create Font as a Member Variable (Global Font) of
the class i m using to prevent it going out of scope
Joseph M. Newcomer wrote:
> If you have not explicitly done a SetFont, a dynamically-created control will get the
> system font, which is not just bold, but quite different in a lot of ways from most fonts.
> Typically, you will want to set the font of the edit control to the font you desire.
>
> I believe there is a codeproject example that has a dynamically-resizing edit control.
> joe
>
> On 31 Aug 2006 06:51:46 -0700, "Arpit" <arpitpmehta(a)gmail.com> wrote:
>
> >Hi experts,
> >I m preparing Excel kind of thing using SDI application.
> >
> >I m using CEdit object for entering text. I have kept the size of CEdit
> >as the size of my cell(D5 etc..) What i see is that inside my edit Box
> >the text are displayed in bold letters. I dont want this. Moreever
> >after reaching the limit of edit box i should dynamically increase the
> >edit box's size while typing, as needed. See Microsoft Office Excel
> >2007 (Beta) for further checking.. Can any one of u guide me to how to
> >do this????
> >Thanks
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm

From: Joseph M. Newcomer on
What I usually do is a GetFont of whatever dialog I'm in, then change the face name and
create the new font. This means that my font follows the desired scaling of the user,
which helps me keep the look-and-feel desired by the user.
joe

On 3 Sep 2006 23:46:08 -0700, "Arpit" <arpitpmehta(a)gmail.com> wrote:

>Thanks .. I have to create Font as a Member Variable (Global Font) of
>the class i m using to prevent it going out of scope
>Joseph M. Newcomer wrote:
>> If you have not explicitly done a SetFont, a dynamically-created control will get the
>> system font, which is not just bold, but quite different in a lot of ways from most fonts.
>> Typically, you will want to set the font of the edit control to the font you desire.
>>
>> I believe there is a codeproject example that has a dynamically-resizing edit control.
>> joe
>>
>> On 31 Aug 2006 06:51:46 -0700, "Arpit" <arpitpmehta(a)gmail.com> wrote:
>>
>> >Hi experts,
>> >I m preparing Excel kind of thing using SDI application.
>> >
>> >I m using CEdit object for entering text. I have kept the size of CEdit
>> >as the size of my cell(D5 etc..) What i see is that inside my edit Box
>> >the text are displayed in bold letters. I dont want this. Moreever
>> >after reaching the limit of edit box i should dynamically increase the
>> >edit box's size while typing, as needed. See Microsoft Office Excel
>> >2007 (Beta) for further checking.. Can any one of u guide me to how to
>> >do this????
>> >Thanks
>> Joseph M. Newcomer [MVP]
>> email: newcomer(a)flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: IPicture problem
Next: Great news