| |

VerySource

 Forgot password?
 Register
Search
View: 818|Reply: 5

Why is it so troublesome to use TextOut in VS?

[Copy link]

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-10-14 11:30:01
| Show all posts |Read mode
void CEx03aView::OnDraw(CDC* pDC)
{
CEx03aDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
m_str.LoadString(IDS_HELLO);
To

pDC->TextOut(0,0,m_str);//If pDC->TextOut(0,0,"HELLO"); is used directly here, an error will be reported!
pDC->SelectStockObject(GRAY_BRUSH);
pDC->Ellipse(CRect(0,20,100,120));
// TODO: Add drawing code for this machine data here
}
It is relatively simple in vc6!
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-10-14 11:45:01
| Show all posts
pDC->TextOut(0,0,L"HELLO");
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-10-14 12:00:01
| Show all posts
pDC->TextOut(0,0,_T"HELLO");

unicode version: pDC->TextOutW(0,0,_T"HELLO");
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-10-14 17:15:01
| Show all posts
I still like to use pDC->TextOut(0,0,_T("HELLO"));
It is said that the use of unicode is to solve compatibility problems
Reply

Use magic Report

0

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-10-14 18:15:01
| Show all posts
VS requires you to use unicode by default
Reply

Use magic Report

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2020-10-14 18:30:01
| Show all posts
Alas, my foundation is still not strong, thank you!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list