set the size of the text

How do I change the size of the text
when I use textout?
There are correspounding functions
for setting text colors and changing text alignment and that's it. I would like to change the size of the text.
How?

Thanks
Jacky
whlukAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
You need to create a font (CreateFont) and select it into the DC. See the example at

http://msdn.microsoft.com/isapi/msdnlib.idc?theURL=/library/psdk/gdi/fontext_8f6t.htm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
whlukAuthor Commented:
sorry for disturbance, chensu
    what i'm using is CPaintDC, so I must use this context to create the text and CPaintDC is not compatible with
HFONT objects... I guess...

Thanks
Jacky
0
whlukAuthor Commented:
I discovered that some of the windows standard class (for text display) don't support 'size' but no 'color' while on the other hand support 'color' but no 'size'.... is there a standard class that supports both?

Thanks
Jacky
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

whlukAuthor Commented:
I discovered that some of the windows standard class (for text display) don't support 'size' but no 'color' while on the other hand support 'color' but no 'size'.... is there a standard class that supports both?

Thanks
Jacky
0
nietodCommented:
wluck, why did you delete the previous question?  I did not answer it because I wasn't sure that I was sure I was answering what you were asking.  

>> what i'm using is CPaintDC
On the other questin you said you weren't MFC.  Now you are saying you are.  and my answer to the other question had nothing to do with MFC.

>> CPaintDC is not compatible with
>> HFONT objects
You just create the a CFont object using the static CFont::FromHandle() function.  This can be selected into the DC.

>> I discovered that some of the windows standard
>> class (for text display) don't support
>> 'size' but no 'color' while on the other hand
>> support 'color' but no 'size'.... is there a
>> standard class that supports both?
This sounds like the question you deleted, that's not the question you are asking here.
0
whlukAuthor Commented:
sorry, just don't want to confuse everybody... give me a few hours to think about it...and we will resolve the confusion then...

Thanks
Jacky
0
chensuCommented:
void CMyWnd::OnPaint()
{
    CPaintDC dc(this);
    CFont fnt;
    fnt.CreatePointFont(120, _T("Arial"));
    CFont *pOldFont = dc.SelectObject(&fnt);
    dc.TextOut(0, 0 CString(_T("ABC"));
    dc.SelectObject(pOldFont);
}
0
whlukAuthor Commented:
How about changing the color of the text at the same time?
0
nietodCommented:
Use SetTextColor() and SetBkColor()
0
chensuCommented:
Use CDC::SetTextColor, CDC::SetBkColor and CDC::SetBkMode. Try it out.

void CMyWnd::OnPaint()
{
    CPaintDC dc(this);
    CFont fnt;
    fnt.CreatePointFont(120, _T("Arial"));
    CFont *pOldFont = dc.SelectObject(&fnt);
    dc.SetBkMode(TRANSPARENT);
    dc.SetTextColor(RGB(0, 0, 255));
    dc.TextOut(0, 0 CString(_T("ABC"));
    dc.SelectObject(pOldFont);
}
0
whlukAuthor Commented:
How about locating the text in the middle of the client area. I've learned one function that does that, but i forgot its name...
Btw, How do I make a button react to a mouse left click actions... I'm a sucker
you know...


Thanks
Jacky
0
whlukAuthor Commented:
need help urgently
0
nietodCommented:
>> locating the text in the middle of the client
>> area. I've learned one function
>> that does that
There really isn't one that does that.  You can use TextOut() at the right coordinates to center the text or you can use DrawText() and specify the DT_CENTER and DT_VCENTER flags while using a rectangle whose dimensions are the window's client area.

>> How do I make a button react to a mouse
>> left click actions
This is really bejond the bounds of the original question.

you can look for the WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_LBUTTONDBLCLK and conver them to the cooresponding right button messages.  That is, pass the message on to the default window procedure specifying the cooresponding right button message instead of the actual message.
0
whlukAuthor Commented:
need help urgently
0
whlukAuthor Commented:
the ONLBUTTONDOWN message and a function is in place.The second problem being is how do i make it respond to a user's left click action on an 'ok' button...

Thanks
Jacky
0
chensuCommented:
void CMyWnd::OnPaint()
{
    CPaintDC dc(this);

    CFont fnt;
    fnt.CreatePointFont(120, _T("Arial"));
    CFont *pOldFont = dc.SelectObject(&fnt);
 
    dc.SetBkMode(TRANSPARENT);
    dc.SetTextColor(RGB(0, 0, 255));
 
    CRect rect;
    this->GetClientRect(&rect);
    CPoint pt = rect.CenterPoint();

    dc.TextOut(pt.x, pt.y, CString(_T("ABC"));

    dc.SelectObject(pOldFont);
}

Please post a new question on the button issue.
0
whlukAuthor Commented:
I want to display another dialog box too!! I'm using appwizard exe and is a dialog based program...


thanks
Jacky
0
whlukAuthor Commented:
all is fine. Budddy
0
chensuCommented:
Then, grade the answer please.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.