设为首页 加入收藏

TOP

计时器(二十一)
2010-12-30 21:12:14 来源: 作者: 【 】 浏览:16587
Tags:计时器
TROPIC) ;
SetWindowExtEx (hdc, 1000, 1000, NULL) ;
SetViewportExtEx (hdc, cxClient / 2, -cyClient / 2, NULL) ;
SetViewportOrgEx (hdc, cxClient / 2, cyClient / 2, NULL) ;
}

void RotatePoint (POINT pt[], int iNum, int iAngle)
{
int i ;
POINT ptTemp ;

for (i = 0 ; i < iNum ; i++)
{
ptTemp.x = (int) (pt[i].x * cos (TWOPI * iAngle / 360) +
pt[i].y * sin (TWOPI * iAngle / 360)) ;

ptTemp.y = (int) (pt[i].y * cos (TWOPI * iAngle / 360) -
pt[i].x * sin (TWOPI * iAngle / 360)) ;

pt[i] = ptTemp ;
}
}

void DrawClock (HDC hdc)
{
int iAngle ;
POINT pt[3] ;
for (iAngle = 0 ; iAngle < 360 ; iAngle += 6)
{
pt[0].x = 0 ;
pt[0].y = 900 ;

RotatePoint (pt, 1, iAngle) ;

pt[2].x = pt[2].y = iAngle % 5 33 : 100 ;

pt[0].x - = pt[2].x / 2 ;
pt[0].y - = pt[2].y / 2 ;

pt[1].x = pt[0].x + pt[2].x ;
pt[1].y = pt[0].y + pt[2].y ;

SelectObject (hdc, GetStockObject (BLACK_BRUSH)) ;

Ellipse (hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y) ;
}
}

void DrawHands (HDC hdc, SYSTEMTIME * pst, BOOL fChange)
{
static POINT pt[3][5] ={0, -150, 100, 0, 0, 600, -100, 0, 0, -150,
0, -200, 50, 0, 0, 800, -50, 0, 0, -200,
0, 0, 0, 0, 0, 0, 0, 0, 0, 800 } ;
int i, iAngle[3] ;
POINT ptTemp[3][5] ;

iAngle[0]
首页 上一页 18 19 20 21 22 23 24 下一页 尾页 21/27/27
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇子视窗控制项 下一篇滑鼠

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: