求助!exe程序弹出一个对话框,怎么在里面显示文字?

gscool 2008-03-27 10:39:58
我做了一个exe程序,想程序运行的时候弹出一个对话框,然后在里面显示一些文字,该怎么做?
我是照着http://hi.baidu.com/onejw/blog/item/e7b1a423264c0545ad34de9e.html这个里面写的做的。对话框可以弹出来了,但是怎么显示文字啊。他上面写的:
不过要显示文字就要先设定字体,具体操作如下:
先要建立一个CWsScreenDevice:
iScreen = new (ELeave) CWsScreenDevice(iWs);然后可以用GetNearestFontInTwips通过字体名字获得CFont:_LIT(FONT_CH16, "CombinedChinesePlain16");
TFontSpec myFontSpec(FONT_CH16, 200);
iScreen->GetNearestFontInTwips(iFont, myFontSpec);

这些东西是要加在哪里的?我添加到了void CWindow::Draw(const TRect& aRect)这个里面,但是运行到iScreen->GetNearestFontInTwips(iFont, myFontSpec);就报错,该怎么办?

这个是我加的
void CWindow::Draw(const TRect& aRect)
{
// Drawing to a window is done using functions supplied by
// the graphics context (CWindowGC), not the window.
CWindowGc* gc = SystemGc(); // get a gc
gc->SetClippingRect(aRect); // clip outside this rect
gc->Clear(aRect); // clear
TSize size=iWindow.Size();
TInt width=size.iWidth;
TInt height=size.iHeight;
// Draw a square border
gc->DrawLine(TPoint(0,0),TPoint(0,height-1));
gc->DrawLine (TPoint (0, height-1), TPoint (width-1, height-1));
gc->DrawLine(TPoint(width-1,height-1),TPoint(width-1,0));
gc->DrawLine (TPoint (width-1, 0), TPoint (0, 0));

//写字

_LIT(FONT_CH16, "Swiss");
TFontSpec myFontSpec(_L("Times New Roman"),200);
CWsScreenDevice *iScreen = new(ELeave)CWsScreenDevice(iClient->iWs);
iScreen->GetNearestFontInTwips(iFont, myFontSpec);
gc->UseFont(iFont);
gc->DrawText(_L("P"),TPoint(45,100));
}
...全文
309 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
gscool 2008-03-27
  • 打赏
  • 举报
回复
是个exe程序啊
CEikonEnv这个没办法用吧?
xintong8171 2008-03-27
  • 打赏
  • 举报
回复
CEikonEnv::Static()-> InfoWinL(_L(""),F_Result); //显示
类似于Messagebox,具体可查看SDk
dyw 2008-03-27
  • 打赏
  • 举报
回复
报什么错误?分析错误代码。

3,119

社区成员

发帖
与我相关
我的任务
社区描述
塞班系统(Symbian系统)是塞班公司为手机而设计的操作系统,它的前身是英国宝意昂公司的 EP ( Electronic Piece of cheese)操作系统。
社区管理员
  • Symbian社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧