每一个细节搞懂都很艰难,drawtext画字,屏幕确没有显示

dengjian1982 2007-12-24 02:14:56
nokia VRex例子,我画图字确没有显示,是什么原因
void CVRexVideoContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
//gc.SetPenStyle( CGraphicsContext::ENullPen );
//gc.SetBrushColor( KRgbGray );
//gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
//gc.DrawRect( aRect );

gc.UseFont(iEikonEnv->NormalFont());
//gc.Clear();
TPoint p(40,40);
gc.DrawText(_L("111111"),p);
gc.DiscardFont();
}
...全文
337 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
meiZiNick 2008-04-30
  • 打赏
  • 举报
回复
接分先!
zengcity 2008-01-29
  • 打赏
  • 举报
回复
CWindowGc& gc = SystemGc();

TRect rect=Rect();
gc.Clear(rect);

试试。。。
mickeyfirst 2007-12-28
  • 打赏
  • 举报
回复


我在uiq上运行了你的代码,没有问题。请看这个图。

我发的代码也是在uiq上的,很抱歉,没有说明平台。
mShopping 2007-12-28
  • 打赏
  • 举报
回复
要设置设画笔的style,color,坐标纵坐标值不能设为0,因为,drawtext的TPoint是指他的左下角的坐标。
lucian2007 2007-12-28
  • 打赏
  • 举报
回复
为什么不好调试呢?
dengjian1982 2007-12-28
  • 打赏
  • 举报
回复
draw函数好像不好调试吧
vnking 2007-12-27
  • 打赏
  • 举报
回复
我刚好也被耍了一下,坐标一定不能用TPoint(0,0),笔的颜色要设!

_L("") 可能有问题?
dengjian1982 2007-12-27
  • 打赏
  • 举报
回复
改了也无法显示
mickeyfirst 2007-12-25
  • 打赏
  • 举报
回复
正好有个例子给你
 // Window graphics context
CWindowGc& gc = SystemGc();
// Area in which we shall draw
TRect drawRect = Rect();

// Default brush style
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
// Start with a clear screen
gc.SetBrushColor(KRgbWhite);
gc.Clear(drawRect);
gc.SetBrushStyle(CGraphicsContext::ENullBrush);

// ERROR:在这里要是不给pen设置颜色,容易panic
gc.SetPenColor(KRgbBlack);

const CFont* fontUsed = iEikonEnv->TitleFont();
gc.UseFont(fontUsed);
TBuf<20> des = L"北京";
TInt baselineOffset=(drawRect.Height() - fontUsed->HeightInPixels())/2;
gc.DrawText(des,drawRect,baselineOffset,CGraphicsContext::ECenter, 0);
gc.DiscardFont();
anel 2007-12-24
  • 打赏
  • 举报
回复
SetPenStyle(ESolidPen);

DrawNow刷新
lucian2007 2007-12-24
  • 打赏
  • 举报
回复
Text drawing is subject to the drawing mode, the current font, pen colour, word justification and character justification.

尝试1下,SetPenColor()
也许是默认的颜色看不出变化!

3,119

社区成员

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

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