代码如下:
- C/C++ code
this->Gc->SetBrushColor(TRgb(0,0,0,255)); //this->Gc->Clear(); this->Gc->SetPenColor(TRgb(255,25,255,120)); this->Gc->SetBrushStyle(CGraphicsContext::ESolidBrush); this->Gc->SetBrushColor(TRgb(25,50,255,255)); //注意这里的 TRect 无论我把第二个参数该为何值,绘制出来的矩形始终处于最上面,也就是Y轴坐标始终无法改动 this->Gc->DrawRoundRect(TRect(0,125,260,30),TSize(RoundW,RoundH)); TFontSpec fontSpec; fontSpec.iHeight=120; fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal); CFont* pFont = NULL; CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips(pFont, fontSpec); this->Gc->SetBrushColor(TRgb(55,25,255,255)); this->Gc->SetPenColor(TRgb(55,125,125,255)); _LIT(Hello,"Coding is Fucking Fuckable!"); this->Gc->UseFont(pFont); //这里,我意向中想要在GC的任意位置绘制文字,但如同上面绘制矩形一样,根本行不通~ this->Gc->DrawText(Hello,TRect(0,0,260,30),20,CGraphicsContext::ECenter); //this->Gc->Clear(); return 1;
------解决方案--------------------
试下这个
this->Gc->DrawRoundRect(TRect(0,125,260,150),TSize(RoundW,RoundH));