本文介绍了带有数组的DrawText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,这个编码基于2008年。呃,任何人都可以教我如何转换成visual 2012版本。我只知道如何用文字书写,只需在DrawText中添加_T infront。



Hello this coding is based in 2008. Er, can anyone teach me how to convert in into visual 2012 version. I only know how to write in text, just add _T infront of it in DrawText.

static const char* days[] = { "MON", "THU", "WED", "THR", "FRI" };



                    dc.DrawText( (days[i-1], 3, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE );







错误在这里。






The error is here.

childview.cpp(194): error C2664: 'int CDC::DrawTextW(LPCTSTR,int,LPRECT,UINT)' : cannot convert parameter 1 from 'const char *' to 'LPCTSTR'

推荐答案


static const char* days[] = { "MON", "THU", "WED", "THR", "FRI" };



                    dc.DrawText( (_T(days[i-1]), 3, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE );


这篇关于带有数组的DrawText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 11:13