Вывод ответа #1863111389
-помощь новичкам
Derail, странно вроде то же самое
void CCClock::ConstructL()
{
ReadSettings();
iBitmap=new (ELeave) CFbsBitmap();
iBitmap->Create(TSize(1, 1), EColor16M);
iBitDevice = CFbsBitmapDevice::NewL(iBitmap);
iBitDevice->CreateContext(iBitGc);
iMask=new (ELeave) CFbsBitmap();
iMask->Create(TSize(1, 1), EColor16M);
iMaskDevice = CFbsBitmapDevice::NewL(iMask);
iMaskDevice->CreateContext(iMaskGc);
TFontSpec MyeFontSpec (KFontArial, iSettings[2]*iSettings[2]);
MyeFontSpec.iTypeface.SetIsProportional(ETrue);
User::LeaveIfError(iMaskDevice->GetNearestFontInTwips(iFont, MyeFontSpec));
//...
Redraw();
//...
}
void CCClock::Redraw()
{
TRgb Black(0, 0, 0);
TTime currTime;
currTime.HomeTime();
TBuf<255> time;
currTime.FormatL(time, KTimeFormat);
iBitmap->Resize(TSize(iFont->TextWidthInPixels(time), iFont->HeightInPixels()));
iMask->Resize(TSize(iFont->TextWidthInPixels(time), iFont->HeightInPixels()));
iBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
iBitGc->SetBrushColor(Black);
iBitGc->DrawRect(TRect(0, 0, iBitmap->SizeInPixels().iWidth, iBitmap->SizeInPixels().iHeight)); // тут вываливается паника
iMaskGc->UseFont(iFont);
iMaskGc->SetPenColor(Black);
iMaskGc->Clear();
iMaskGc->DrawText(time, TRect(0, 0, iMask->SizeInPixels().iWidth, iMask->SizeInPixels().iHeight));
}
ответ опубликован:
- 5
- 1
- 2
- 3
- 4
- 5

