91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 187KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-15
  • 語言: 其他
  • 標簽: clock??win32??API編程??

資源簡介

用c編寫的模擬時鐘。模擬時鐘不用考慮國際化問題,但圖形復雜。而且我們還需要一些三角函數知識。 已修正,既有代碼亦有效果。exe在release文件夾內??芍苯邮褂谩?img width=510 src=http://www.sh-liguang.com/pic/267400.jpg />

資源截圖

代碼片段和文件信息


#include?
#include??

#define?ID_TIMER????1
#define?TWOPI???????(2?*?3.14159)

LRESULT?CALLBACK?WndProc?(HWND?UINT?WPARAM?LPARAM)?;

int?WINAPI?WinMain?(HINSTANCE?hInstance?HINSTANCE?hPrevInstance
????????????????????PSTR?szCmdLine?int?iCmdShow)
{
?????static?TCHAR?szAppName[]?=?TEXT?(“Clock“)?;
?????HWND?????????hwnd;
?????MSG??????????msg;
?????WNDCLASS?????wndclass?;
?????
?????wndclass.style?????????=?CS_HREDRAW?|?CS_VREDRAW?;
?????wndclass.lpfnWndProc???=?WndProc?;
?????wndclass.cbClsExtra????=?0?;
?????wndclass.cbWndExtra????=?0?;
?????wndclass.hInstance?????=?hInstance?;
?????wndclass.hIcon?????????=?NULL?;
?????wndclass.hCursor???????=?LoadCursor?(NULL?IDC_ARROW)?;
?????wndclass.hbrBackground?=?(HBRUSH)?GetStockobject?(WHITE_BRUSH)?;
?????wndclass.lpszMenuName??=?NULL?;
?????wndclass.lpszClassName?=?szAppName?;
?????
?????if?(!RegisterClass?(&wndclass))
?????{
??????????MessageBox?(NULL?TEXT?(“Program?requires?Windows?NT!“)?
??????????????????????szAppName?MB_IConerror)?;
??????????return?0?;
?????}
?????
?????hwnd?=?CreateWindow?(szAppName?TEXT?(“Analog?Clock“)
??????????????????????????WS_OVERLAPPEDWINDOW
??????????????????????????CW_USEDEFAULT?CW_USEDEFAULT
??????????????????????????CW_USEDEFAULT?CW_USEDEFAULT
??????????????????????????NULL?NULL?hInstance?NULL)?;
?????
?????ShowWindow?(hwnd?iCmdShow)?;
?????UpdateWindow?(hwnd)?;
?????
?????while?(GetMessage?(&msg?NULL?0?0))
?????{
??????????TranslateMessage?(&msg)?;
??????????DispatchMessage?(&msg)?;
?????}
?????return?msg.wParam?;
}

void?SetIsotropic?(HDC?hdc?int?cxClient?int?cyClient)
{
?????SetMapMode?(hdc?MM_ISOTROPIC)?;
?????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??????{
??????????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??????{
??????????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)?;
????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-12-08?10:34??Clock\
?????文件????????5513??2013-12-08?10:34??Clock\Clock.c
?????文件?????????875??2009-09-25?12:05??Clock\Clock.sln
?????文件????????8192??2009-09-25?12:05??Clock\Clock.suo
?????文件????????5055??2009-09-25?12:05??Clock\Clock.vcproj
?????目錄???????????0??2013-12-08?10:34??Clock\Debug\
?????文件??????485888??2009-09-25?12:05??Clock\Debug\Clock.exe
?????目錄???????????0??2013-12-08?10:34??Clock\Release\
?????文件???????64000??2009-09-25?12:05??Clock\Release\Clock.exe

評論

共有 條評論