关闭

急!!活动对象画表针出了问题!

49人阅读 评论(0) 收藏 举报
不知道什么问题。表述如下:

代码:


void CMultiViewTestAppView::DrawClock(CWindowGc& aGc, const TRect& aRect, TInt aHour, TInt aMinute, TInt aSec) const
        {
        aGc.DrawArc(aRect,TPoint(0,0),TPoint(0,0));
        const TReal Pi = 3.1415926;
        TReal angleDegree = Pi*2/12;
        
        TInt arcRadio = aRect.Width()/2;  //表盘半径
        TInt scaleLen = 5;                //刻度长度
        
        TPoint pointFrom,pointTo;
        aGc.SetPenSize(TSize(1,1));
        //画刻度
        for(int i=0; i<12; i++)
                {
                
                pointFrom.iX = aRect.Center().iX + (TInt)((arcRadio-scaleLen)*cos(i*angleDegree));
                pointFrom.iY = aRect.Center().iY + (TInt)((arcRadio-scaleLen)*sin(i*angleDegree));
                pointTo.iX = aRect.Center().iX + (TInt)(arcRadio*cos(i*angleDegree));
                pointTo.iY = aRect.Center().iY + (TInt)(arcRadio*sin(i*angleDegree));
                
                aGc.DrawLine(pointFrom,pointTo);
                }
        //画表针
        TInt hourPenSize = 4;
        TInt minutePenSize = 2;
        TInt secondPenSize = 1;
        
        TInt hourLengh = arcRadio*4/7;
        TInt minuteLengh = arcRadio*2/3;
        TInt secondLengh = arcRadio*4/5;

        TReal penDegree = 0;   //偏转角度
        
        //画时针
        penDegree = Pi*2*aHour/12 + (Pi*2/12)*aMinute/60-Pi/2;
        pointFrom.iX = aRect.Center().iX + (TInt)(3*cos(penDegree+Pi));
        pointFrom.iY = aRect.Center().iY + (TInt)(3*sin(penDegree+Pi));
        pointTo.iX = aRect.Center().iX + (TInt)(hourLengh*cos(penDegree));
        pointTo.iY = aRect.Center().iY + (TInt)(hourLengh*sin(penDegree));
        
        aGc.SetPenSize(TSize(hourPenSize,hourPenSize));
        aGc.DrawLine(pointFrom,pointTo);
        
        //画分针
        penDegree =(Pi*2/12)*aMinute/60-Pi/2;
        pointFrom.iX = aRect.Center().iX + (TInt)(3*cos(penDegree+Pi));
        pointFrom.iY = aRect.Center().iY + (TInt)(3*sin(penDegree+Pi));
        pointTo.iX = aRect.Center().iX + (TInt)(minuteLengh*cos(penDegree));
        pointTo.iY = aRect.Center().iY + (TInt)(minuteLengh*sin(penDegree));

        aGc.SetPenSize(TSize(minutePenSize,minutePenSize));
        aGc.DrawLine(pointFrom,pointTo);
        
        //画秒针
        penDegree =Pi*2*aSec/60-Pi/2;
        pointFrom.iX = aRect.Center().iX + (TInt)(3*cos(penDegree+Pi));
      pointFrom.iY = aRect.Center().iY + (TInt)(3*sin(penDegree+Pi));      
        pointTo.iX = aRect.Center().iX + (TInt)(secondLengh*cos(penDegree));
        pointTo.iY = aRect.Center().iY + (TInt)(secondLengh*sin(penDegree));

        aGc.SetPenSize(TSize(secondPenSize,secondPenSize));
        aGc.DrawLine(pointFrom,pointTo);
        }
 


问题就出在了加粗的哪一行。。
如果我改成:pointFrom.iY = 50.程序正常运行。秒针正常转动,只是表针不再表盘中央了。。
改成:pointFrom.iY = 100就报同样的错误!!

错误报告:

   72.660        AKNSKINS: (Error) "CAknsAppSkinInstance::GetLayoutBitmap Srv update failed -1"
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:914次
    • 积分:162
    • 等级:
    • 排名:千里之外
    • 原创:16篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条
    文章存档