vc编写一个模拟时钟的程序(VC write an analog clock program).doc

上传人:marr****208 文档编号:150425460 上传时间:2020-11-06 格式:DOC 页数:11 大小:37.50KB
返回 下载 相关 举报
vc编写一个模拟时钟的程序(VC write an analog clock program).doc_第1页
第1页 / 共11页
vc编写一个模拟时钟的程序(VC write an analog clock program).doc_第2页
第2页 / 共11页
vc编写一个模拟时钟的程序(VC write an analog clock program).doc_第3页
第3页 / 共11页
vc编写一个模拟时钟的程序(VC write an analog clock program).doc_第4页
第4页 / 共11页
vc编写一个模拟时钟的程序(VC write an analog clock program).doc_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《vc编写一个模拟时钟的程序(VC write an analog clock program).doc》由会员分享,可在线阅读,更多相关《vc编写一个模拟时钟的程序(VC write an analog clock program).doc(11页珍藏版)》请在金锄头文库上搜索。

1、vc编写一个模拟时钟的程序(VC write an analog clock program)Im sorry, my program is too big, 4M, because there are other functionsNo way. Towel section proceduresVoid CFill_areaView: myShowColok (CDC, *pDC)M_time=CTime: GetCurrentTime ();PDC-FillRect (&CRect (0,0, rect.Width (), rect.Height (), &CBrush (RGB (100

2、100100);CBrush brush (RGB (150150150);CBrush *oldbrush=pDC-SelectObject (&brush);CPen pen (PS_SOLID, 3, RGB (0,0,0);CPen *oldpen=pDC-SelectObject (&pen);PDC-Ellipse (rect.Width (), /2- (rect.Height (), /2, rect.Height () (/2-10 (), /2- (rect.Height (), /2, rect.Width (), /2+ (rect.Height (), /2, rec

3、t.Height () (&CRect (), /2+ (rect.Height (), /2-10 (/2-10) /2) /2-10 ();PDC-Ellipse (&CRect (rect.Width (), /2-3, rect.Height (), /2-3, rect.Width (), /2+3, rect.Height () /2+3);CPen PEN2 (PS_SOLID, 7, RGB (0,0,0);PDC-SelectObject (&pen2);PDC-MoveTo (rect.Width (), /2, rect.Height (), /2-16* (rect.H

4、eight (), /2-10) /20);PDC-LineTo (rect.Width (), /2-15* (rect.Height (), /20, rect.Height (), /2-6* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2-15* (rect.Height (), /20, rect.Height (), /2+12* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2+15* (rect.Height (),

5、/20, rect.Height (), /2+12* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2+15* (rect.Height (), /20, rect.Height (), /2-6* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2, rect.Height (), /2-16* (rect.Height (), /2-10) /20);PDC-MoveTo (rect.Width (), /2-15* (rect.H

6、eight (), /20+25, rect.Height (), /2+12* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2-15* (rect.Height (), /20+25, rect.Height (), /2+12* (rect.Height () /2-10) /20+30 (/2-10);PDC-LineTo (rect.Width (), /2-15* (rect.Height (), /20+25+40, rect.Height (), /2+12* (rect.Height () /2-

7、10) /20+30 (/2-10);PDC-LineTo (rect.Width (), /2-15* (rect.Height (), /20+25+40, rect.Height (), /2+12* (rect.Height () /2-10) /20 (/2-10);PDC-MoveTo (rect.Width (), /2+15* (rect.Height (), /20-25, rect.Height (), /2+12* (rect.Height () /2-10) /20 (/2-10);PDC-LineTo (rect.Width (), /2+15* (rect.Heig

8、ht (), /20-25, rect.Height (), /2+12* (rect.Height () /2-10) /20+30 (/2-10);PDC-LineTo (rect.Width (), /2+15* (rect.Height (), /20-25-40, rect.Height (), /2+12* (rect.Height () /2-10) /20+30 (/2-10);PDC-LineTo (rect.Width (), /2+15* (rect.Height (), /20-25-40, rect.Height (), /2+12* (rect.Height ()

9、/2-10) /20 (/2-10);CPen pen1 (PS_SOLID, 1, RGB (0,0,0);PDC-SelectObject (&pen1);Double alpha=0;MyPoint, P1, P2, p3;P1=m_pointColok0, p2=m_pointColok4, p3=m_pointColok5;For (int i=0; iMoveTo (ChangePoint (P1).X, ChangePoint (P1).Y);P2.x=m_pointColok4.x*cos (alpha) -m_pointColok4.y*sin (alpha);P2.y=m_

10、pointColok4.x*sin (alpha) +m_pointColok4.y*cos (alpha);P3.x=m_pointColok5.x*cos (alpha) -m_pointColok5.y*sin (alpha);P3.y=m_pointColok5.x*sin (alpha) +m_pointColok5.y*cos (alpha);If (i%5=0)PDC-LineTo (ChangePoint (P2).X, ChangePoint (P2).Y);ElsePDC-LineTo (ChangePoint (P3).X, ChangePoint (P3).Y);PDC

11、-SetBkMode (TRANSPARENT);CFont font;Font.CreateFont (16,12,0,0, FW_NORMAL),假,假,假,ansi_charset,out_default_precis,clip_default_precis,default_quality,default_pitch | ff_swiss,“Arial”);CFont * oldfont = PDC - SelectObject(与字体);/ /改变字体PDC - SetTextColor(RGB(255205100);PDC - TextOut(矩形。width() / 2-0.9 *

12、(矩形。height() / 2-10)/ 2,矩形。height() / 2-5,“9”);PDC - TextOut(矩形。width() / 2 + 0.9 *(矩形。height() / 2-30)/ 2,矩形。height() / 2-5,“3”);PDC - TextOut(矩形。width() / 2-10,矩形。height() / 2-0.9 *(矩形。height() / 2-10)/ 2,“12”);PDC - TextOut(矩形。width() / 2-10,矩形。height() / 2 + 0.9 *(矩形。height() / 2-10)/ 2-10,“6”);

13、font1 CFont;font1。CreateFont(10,8,0,0,fw_normal,假,假,假,ansi_charset,out_default_precis,clip_default_precis,default_quality,default_pitch | ff_swiss,“Arial”);PDC - SelectObject(与font1);/ /改变字体PDC - setbkcolor(RGB(255,0,0);PDC - TextOut(矩形。width() / 2-0.2 *(矩形。height() / 2-10)/ 2,矩形。height() / 2 + 0.2

14、*(矩形。height() / 2-10)/ 2,“redor1”);PDC - TextOut(矩形。width() / 2-0.1 *(矩形。height() / 2-10)/ 2,矩形。height() / 2-0.7 *(矩形。height() / 2-10)/ 2,“医生”);PDC - SelectObject(oldfont);/画表盘/指针P1。x = m_pointcolok 1 。X * cos(教)- m_pointcolok 1 。Y *罪(教);P1。Y = m_pointcolok 1 。X *罪(教)+ m_pointcolok 1 。Y * cos(教);P2。x = m_pointcolok 2 。X * cos(叫)- m_pointcolok 2 。Y *罪(叫);P2。Y = m_pointcolok 2 。X *罪(叫)+ m_pointcolok 2 。Y * cos(叫);P3。x = m_pointcolok 3 。X * cos(jiao3)- m_pointcolok 3 。Y *罪(

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号