ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
探讨误差: 注1: 以下 欧氏距离,指误差,且是方差,即欧氏平方距离(省去开方)。 [isFirsttimeEqualp1p:0][C1rad:1.0654362715284031448703672140254639089107513427734375]:C1角度:61045][c1A1:193.64900805416846196749247610569000244140625][c1B1:350.000088113755509766633622348308563232421875][C2rad2:0.252688776135444659320938853852567262947559356689453125]:C2角度:14478]-[c2A1:193.648741253672369566629640758037567138671875][c2B1:50.00165008145478395817917771637439727783203125],{此时欧式距离:2.5066927555923115278346813283860683441162109375} P1点: ``` [isFirsttimeEqualp1p:0][C1rad:1.06535]:C1角度:6104][c1A1:193.68][c1B1:349.983][C2rad2:0.252549]:C2角度:14470]-[c2A1:193.656][c2B1:49.9746],{此时欧式距离:615.474} [isFirsttimeEqualp1p:0][C1rad:1.06535]:C1角度:6104][c1A1:193.68][c1B1:349.983][C2rad2:0.252567]:C2角度:14471]-[c2A1:193.655][c2B1:49.978],{此时欧式距离:610.292} ``` 结果:C1:61.045 C2:14.478 P2点: [isFirsttimeEqualp1p:0][C1rad:2.07602]:C1角度:118947][c1A1:-193.6][c1B1:350.027] [C2rad2:2.88852]:C2角度:1655]-[c2A1:-193.63][c2B1:50.076],{此时欧式距离:3261.3} 结果: C1:118.955 C2:165.522 验算: C1: 118.955-90 = 28.955 61.045-90== -28.955 C2: 90- 14.478= 75.522 90-165.522= 75.522 完全吻合了! 下面是作图的结果: ![](https://box.kancloud.cn/a0a35f350e9e58139d49e4b4be562fda_855x732.png) 注意上图中: 红、蓝相交的就是迭代求出的结合点了。 迭代求重合点的核心代码: ``` //P2点//for21100 long double Shortest_euclidDistance02 = 999999999999999.9; for (int i1 = (119000 -1000); i1 <= (119000+1000); ++i1) {//for21100 //for (int i1 = 0; i1 < 3601; ++i1) {//for1100 // long double c1_rad1 = long double((long double)hPi / 900 * i1) / 1000000000000000000 / 10; // 1000000000000000000; //10^18倍的PI; long double c1_rad1 = long double((long double)Pild*i1 / 180) / 1000; //等价(但不太精确的)表达 long double c1_rad1 = Pild * i1 / 180 /10; long double c1_a001 = C1_200_R01 * cos(c1_rad1); //int c1_a001 = C1_200_R01 * cos(c1_rad1); long double c1_b001 = C1_200_R01 * sin(c1_rad1); //int c1_b001 = C1_200_R01 * sin(c1_rad1); // //2号圆(下圆) for (int j2 = (165000/100)-10; j2 <= ( 166100/100 )+10; ++j2) { //for (int j2 = (3500-500); j2 <= ( 3600+500 ); ++j2) { long double c2_rad02 = long double((long double)Pild*j2 / 180) / 10;// 00; //;// / 100; // 1000; // / 10; uint64_t uint64_c2_a001 = long double((long double)hPi / 9000 * j2) * cos(c2_rad02); //必须:全部化为 uint64的大长整数运算 uint64_t uint64_c2_b002 = long double((long double)hPi / 9000 * j2) *sin(c2_rad02); long double c2_a001 = C2_200_R02 * cos(c2_rad02); //int c2_a001 = C2_200_R02 * cos(c2_rad02); long double c2_b002 = C2_200_R02 * sin(c2_rad02); //int c2_b002 = C2_200_R02 * sin(c2_rad02); //两个坐标的4个值取精度,后比较 long double intc1_a001 = c1Apianyi_A1 * 1000 + int((double)c1_a001 * 1000); long double intc1_b001 = c1Bpianyi_B1 * 1000 + c1_b001 * 1000; long double intc2_a001 = c2Apianyi_A2 * 1000 + c2_a001 * 1000; long double intc2_b002 = c2Bpianyi_B2 * 1000 + c2_b002 * 1000; outStream << "[C1rad:" << c1_rad1 << "]:"; outStream << "C1角度:" << i1 << "]"; outStream << "[c1A1:" << intc1_a001 << "]"; outStream << "[c1B1:" << intc1_b001 << "]"; outStream << "[C2rad2:" << c2_rad02 << "]:"; outStream << "C2角度:" << j2 << "]"; outStream << "-[c2A1:" << intc2_a001 << "]"; outStream << "[c2B1:" << intc2_b002 << "]" << endl; // // EduclidDistanceOrWhethShortest参数 (x1,y1,x2,y2); if (Shortest_euclidDistance02 > EduclidDistanceOrWhethShortest(intc1_a001, intc1_b001, intc2_a001, intc2_b002)) {//if2100 Shortest_euclidDistance02 = EduclidDistanceOrWhethShortest(intc1_a001, intc1_b001, intc2_a001, intc2_b002); outStrea0m2 << "[isFirsttimeEqualp1p:" << isFirsttimeEqualp1p2 << "]"; outStrea0m2 << "[C1rad:" << c1_rad1 << "]:"; outStrea0m2 << "C1角度:" << i1 << "]"; outStrea0m2 << "[c1A1:" << c1_a001 << "]"; outStrea0m2 << "[c1B1:" << c1_b001 << "]"; outStrea0m2 << "[C2rad2:" << c2_rad02 << "]:"; outStrea0m2 << "C2角度:" << j2 << "]"; outStrea0m2 << "-[c2A1:" << c2_a001 << "]"; outStrea0m2 << "[c2B1:" << c2_b002 << "]"; outStrea0m2 << ",{此时欧式距离:" << Shortest_euclidDistance02 << "}" << endl; }//if2100 else if ( ((intc1_a001) == (intc2_a001)) && ((intc1_b001) == (intc2_b002))) { //if2100 SetPixe02(hdc, c2Apianyi_A2 + c2_a001, c2Bpianyi_B2 + c2_b002, RGB(255, 0, 0));//红 0, 0, 228));//暗红 ++isFirsttimeEqualp1p2; // cout << "[isFirsttimeEqualp1p:" << isFirsttimeEqualp1p2 << "]"; cout << "[C1rad:" << c1_rad1 << "]:"; cout << "C1角度:" << i1 << "]"; cout << "[c2B1:" << c2_b002 << "]" << endl; if (1 == isFirsttimeEqualp1p2) {//if3100 p01.a1 = intc2_a001; p01.b1 = intc1_b001; }//if3100 // if (2 == isFirsttimeEqualp1p2) {//if3200 p02.a1 = intc2_a001; p02.b1 = intc1_b001; }//if3200 // }//if2100 else {//if2100else2100 SetPixe02(hdc, c2Apianyi_A2 + c2_a001, c2Bpianyi_B2 + c2_b002, RGB(255, 0, 0));//暗蓝 }//if2100else2100 }//for1200 // SetPixe02(hdc, c1Apianyi_A1 + c1_a001, c1Bpianyi_B1 + c1_b001, RGB(0, 255, 0) ); //亮绿 128, 0));//暗绿 }//for21100 //P2点//for21100-End ``` 再帖一下 两个(重合)点的求法与作图的方法, 1、先贴结果图: 要注意,绿色和红色的两个相交点…… ![](https://box.kancloud.cn/75c4618f2523ddac1f13b01ed275caab_771x541.png) 2、再帖(较完整)代码: ``` // Project1clzz002billiard181010b2.cpp : 定义应用程序的入口点。 // #include "stdafx.h" #include "Project1clzz002billiard181010b2.h" #include <iostream> #include <iomanip> #include <fstream> using namespace std; #define MAX_LOADSTRING 100 // 全局变量: //浮点数计PI(π): long double PIld = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196; //输出有效为: 3.141592653589793115997963468544185161590576171875 //有效位: 3.141592653589793 //等价 //PILD01=3.141592653589793; long double Pi2ld = 3.1415926535897932; // uint64_t PI_uint64t = 3141592653589793238; //31415926535897932384;//整数常量太大 uint64_t halfPI_uint64t = 15707963267948966192; // halfPI=90度; 157079632679489661923;整数常量太大 uint64_t hPi = 15707963267948966192;// halfPI=90度; // HINSTANCE hInst; // 当前实例 WCHAR szTitle[MAX_LOADSTRING]; // 标题栏文本 WCHAR szWindowClass[MAX_LOADSTRING]; // 主窗口类名 // struct Position0old1 { //定义交点位置 int a1; int b1; } p0old1, p0old2; struct Position001 { //定义交点位置 double c1angle; //角度 double c2angle; double a1; //坐标 double b2; }; Position001 P01 = { 61.045, 14.478}; Position001 P02 = { 118.955, 165.522 }; // 此代码模块中包含的函数的前向声明: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // TODO: 在此处放置代码。 // //调用Console控制台 AllocConsole(); #pragma warning(disable:4996) _tfreopen(TEXT("CONOUT$"), TEXT("w"), stdout); _tfreopen(TEXT("CONOUT$"), TEXT("w"), stderr); _tfreopen(TEXT("CONIN$"), TEXT("r"), stdin); #pragma warning(default:4996) _tsetlocale(LC_ALL, TEXT("chs")); // cout << setprecision(99) << PIld << endl; cout << setprecision(99) << Pi2ld << endl; // // 初始化全局字符串 LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadStringW(hInstance, IDC_PROJECT1CLZZ002BILLIARD181010B2, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // 执行应用程序初始化: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_PROJECT1CLZZ002BILLIARD181010B2)); MSG msg; // 主消息循环: while (GetMessage(&msg, nullptr, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return (int) msg.wParam; } // // 函数: MyRegisterClass() // // 目标: 注册窗口类。 // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEXW wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_PROJECT1CLZZ002BILLIARD181010B2)); wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_PROJECT1CLZZ002BILLIARD181010B2); wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); return RegisterClassExW(&wcex); } // // 函数: InitInstance(HINSTANCE, int) // // 目标: 保存实例句柄并创建主窗口 // // 注释: // // 在此函数中,我们在全局变量中保存实例句柄并 // 创建和显示主程序窗口。 // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { hInst = hInstance; // 将实例句柄存储在全局变量中 HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr); if (!hWnd) { return FALSE; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return TRUE; } // // //p01 定义:当1号圆(大圆)在上的时候,0度位置(右侧)的为p01,左侧为p02 // 当1号圆(大圆)在左的时候,90度位置(上方)的为p01,下方:270度位置为p02 // long double EduclidDistanceOrWhethShortest(long double x1, long double y1, long double x2, long double y2) {//33000 long double tmp_ld = (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2); return (tmp_ld ); }//33000 // //为图形旋转、变形、做的封装 int SetPixe01d(HDC hdc, double x01, double y01, COLORREF rgb1) { SetPixel(hdc, x01, 700 - y01, rgb1);// return 1; }//int SetPixe02 // //重新绘图函数模块: int wm01paint01(HWND hWnd, PAINTSTRUCT ps, HDC hdc) {//int wm01paint01 //1100 // int C1_200_R01 = 400;//大圆半径(又称1号圆半径) int C2_200_R02 = 200;//小圆半径又称2号圆 int c1Bpianyi_B1 = 0; //大圆用初始值-(圆心的偏移量横坐标-上下坐标(暂时)为0 int c1Apianyi_A1 = 400;//大圆圆心位置-坐标(左右坐标 int c2Bpianyi_B2 = 300;//小圆圆心位置-上下坐标 int c2Apianyi_A2 = 400;//小圆圆心位置-左右坐标 int c1C2_Distance = 300;//两圆圆心间距 // //文件流操作 ofstream outStream; ofstream outStrea0m2; ofstream outStrea0m3; outStream.open("f://out18File1011.txt"); outStrea0m2.open("f://out18File1011a1.txt"); outStrea0m3.open("f://out18File1012b3.txt"); // //找交点,P1 { //找P1交点 long double Shortest_euclidDistance001 = 999999999999999.8751; //99999 99999 99999.875f是精确表达上限(小数点前15个9 //迭代、逼近找两圆交点 // for (long i1 = 60.93*1000; i1 <= 61.95*1000; ++i1) {//for1100i1 //根据极坐标参数求笛卡尔直角坐标点: long double c1_rad1 = (long double)PIld*((long double)i1 / 180.0) /1000; long double c1_a001 = C1_200_R01 * cos(c1_rad1); //int c1_a001 = C1_200_R01 * cos(c1_rad1); long double c1_b001 = C1_200_R01 * sin(c1_rad1); // for (long j2 = 14.46*1000; j2 <= 14.49*1000; ++j2) {//for2100j2 long double c2_rad02 = (long double)PIld *((long double)j2 / 180.0)/1000; long double c2_a001 = C2_200_R02 * cos(c2_rad02); //int c2_a001 = C2_200_R02 * cos(c2_rad02); long double c2_b002 = C2_200_R02 * sin(c2_rad02); //两个坐标的4个值取精度,后比较 long double doub_c1_a001 = (long double)c1Apianyi_A1 * 10000 + ((long double)c1_a001 * 10000); //最高不要超过15个0 long double doub_c1_b001 = c1Bpianyi_B1 * 10000 + c1_b001 * 10000; long double doub_c2_a001 = c2Apianyi_A2 * 10000 + c2_a001 * 10000; long double doub_c2_b002 = c2Bpianyi_B2 * 10000 + c2_b002 * 10000; outStream << "[C1rad:" << c1_rad1 << "]:"; outStream << "{C1角度:" << i1 << "}"; outStream << "[坐标c1A1:" << doub_c1_a001 << "]"; outStream << "[c1B1:" << doub_c1_b001 << "]"; outStream << "[C2rad2:" << c2_rad02 << "]:"; outStream << "{C2角度:" << j2 << "]"; outStream << "[c2A1:" << doub_c2_a001 << "]"; outStream << "[c2B1:" << doub_c2_b002 << "]" << endl; long double tmpEduclidDist01 = EduclidDistanceOrWhethShortest(doub_c1_a001, doub_c1_b001, doub_c2_a001, doub_c2_b002); outStream << "{欧氏距离:" << tmpEduclidDist01 << "}" << endl; // EduclidDistanceOrWhethShortest参数 (x1,y1,x2,y2); if (Shortest_euclidDistance001 > tmpEduclidDist01) {//if2100 Shortest_euclidDistance001 = tmpEduclidDist01; // outStrea0m2 << "[C1rad:" << c1_rad1 << "]:"; outStrea0m2 << "{C1角度:" << i1 << "}"; outStrea0m2 << "[坐标c1A1:" << doub_c1_a001 << "]"; outStrea0m2 << "[c1B1:" << doub_c1_b001 << "]"; outStrea0m2 << "[C2rad2:" << c2_rad02 << "]:"; outStrea0m2 << "{C2角度:" << j2 << "]"; outStrea0m2 << "[c2A1:" << doub_c2_a001 << "]"; outStrea0m2 << "[c2B1:" << doub_c2_b002 << "]" << endl; outStrea0m2 << "{欧氏距离:" << tmpEduclidDist01 << "}" << endl; SetPixe01d(hdc, c2Apianyi_A2 + c2_a001, c2Bpianyi_B2 + c2_b002, RGB(255, 200, 0)); //绿色 // }//if2100 else {//if2100else2100 SetPixe01d(hdc, c2Apianyi_A2 + c2_a001, c2Bpianyi_B2 + c2_b002, RGB(0, 200, 0)); //绿色 }//if2100else2100 }//for2100j2 //绘制大圆(或外圆) SetPixe01d(hdc, c1Apianyi_A1 + c1_a001, c1Bpianyi_B1 + c1_b001, RGB(200, 200, 0));// 228, 0));//黄 // }//for1100i1// //(阶段)结果: //[C1rad:1.06535]:{C1角度:6104}[坐标c1A1:5.9368e+06][c1B1:3.49983e+06][C2rad2:0.252549]:{C2角度:14.47][c2A1:5.93656e+06][c2B1:3.49975e+06] //{欧氏距离:64181.4} //再迭代: //[C1rad:1.06544]:{C1角度:61.045}[坐标c1A1:5.93649e+06][c1B1:3.5e+06][C2rad2:0.252689] : {C2角度:14.478][c2A1:5.93649e+06][c2B1:3.50002e+06]{ 欧氏距离:253.008 } //结果,收敛和吻合得很好 //C1:61.045(角度) C2:14.478 就是答案 }//找交点P1-结束 //继续找交点 //找交点P2: {//找交点P2代码块110 //找交点P2 ofstream outStrea0m02b2; outStrea0m02b2.open("f://out18File1012b2b2.txt"); long double Shortest_euclidDistance002 = 999999999999999.8751; //99999 99999 99999.875f是精确表达上限(小数点前15个9 //迭代、逼近找两圆交点 // for (long i1 = 118.85*1000; i1 <= 119.99*1000; ++i1) {//for1100i1 //根据极坐标参数求笛卡尔直角坐标点: long double c1_rad1 = (long double)PIld*((long double)i1 / 180.0)/1000; long double c1_a001 = C1_200_R01 * cos(c1_rad1); //int c1_a001 = C1_200_R01 * cos(c1_rad1); long double c1_b001 = C1_200_R01 * sin(c1_rad1); // for (long j2 = 165.0*1000; j2 <=166.00 *1000; ++j2) {//for2100j2 long double c2_rad02 = (long double)PIld *((long double)j2 / 180.0)/1000; long double c2_a001 = C2_200_R02 * cos(c2_rad02); //int c2_a001 = C2_200_R02 * cos(c2_rad02); long double c2_b002 = C2_200_R02 * sin(c2_rad02); //两个坐标的4个值取精度,后比较 long double doub_c1_a001 = (long double)c1Apianyi_A1 * 10000 + ((long double)c1_a001 * 10000); //最高不要超过15个0 long double doub_c1_b001 = c1Bpianyi_B1 * 10000 + c1_b001 * 10000; long double doub_c2_a001 = c2Apianyi_A2 * 10000 + c2_a001 * 10000; long double doub_c2_b002 = c2Bpianyi_B2 * 10000 + c2_b002 * 10000; outStream << "[C1rad:" << c1_rad1 << "]:"; outStream << "{C1角度:" << i1 << "}"; outStream << "[坐标c1A1:" << doub_c1_a001 << "]"; outStream << "[c1B1:" << doub_c1_b001 << "]"; outStream << "[C2rad2:" << c2_rad02 << "]:"; outStream << "{C2角度:" << j2 << "]"; outStream << "[c2A1:" << doub_c2_a001 << "]"; outStream << "[c2B1:" << doub_c2_b002 << "]" << endl; long double tmpEduclidDist01 = EduclidDistanceOrWhethShortest(doub_c1_a001, doub_c1_b001, doub_c2_a001, doub_c2_b002); outStream << "{欧氏距离:" << tmpEduclidDist01 << "}" << endl; // EduclidDistanceOrWhethShortest参数 (x1,y1,x2,y2); if (Shortest_euclidDistance002 > tmpEduclidDist01) {//if2100 Shortest_euclidDistance002 = tmpEduclidDist01; // outStrea0m02b2 << "[C1rad:" << c1_rad1 << "]:"; outStrea0m02b2 << "{C1角度:" << i1 << "}"; outStrea0m02b2 << "[坐标c1A1:" << doub_c1_a001 << "]"; outStrea0m02b2 << "[c1B1:" << doub_c1_b001 << "]"; outStrea0m02b2 << "[C2rad2:" << c2_rad02 << "]:"; outStrea0m02b2 << "{C2角度:" << j2 << "]"; outStrea0m02b2 << "[c2A1:" << doub_c2_a001 << "]"; outStrea0m02b2 << "[c2B1:" << doub_c2_b002 << "]" << endl; outStrea0m02b2 << "{欧氏距离:" << tmpEduclidDist01 << "}" << endl; SetPixe01d(hdc, c2Apianyi_A2 + c2_a001, c2Bpianyi_B2 + c2_b002, RGB(255, 200, 0)); //绿色 // }//if2100 else {//if2100else2100 SetPixe01d(hdc, c2Apianyi_A2 + c2_a001, c2Bpianyi_B2 + c2_b002, RGB(0, 200, 0)); //绿色 }//if2100else2100 }//for2100j2 //绘制大圆(或外圆) SetPixe01d(hdc, c1Apianyi_A1 + c1_a001, c1Bpianyi_B1 + c1_b001, RGB(200, 200, 0));// 228, 0));//黄 // }//for1100i1// //(阶段)结果: //[C1rad:2.07624]:{C1角度:118.96}[坐标c1A1:2.0632e+06][c1B1:3.49983e+06][C2rad2:2.88904]:{C2角度:165.53][c2A1:2.06344e+06][c2B1:3.49975e+06] //{欧氏距离:64181.4} //再迭代: //[C1rad:2.07616]:{C1角度:118955}[坐标c1A1:2.06351e+06][c1B1:3.5e+06][C2rad2:2.8889]: {C2角度:165522][c2A1:2.06351e+06][c2B1:3.50002e+06]{欧氏距离:253.008} //P1点:C1:61.045(角度) C2:14.478 //P2点:C1:118.955 C2:165.522 就是答案(相交点得角度 //验证: 90-61.045= ( 28.955)== 118.955-90=28.955 //同样验证: 90-14.478=(75.522)== 165.522-90=75.522 }//找交点P2代码块110 //找交点P2-End // return 1; }//int wm01paint01 //1100 // // 函数: WndProc(HWND, UINT, WPARAM, LPARAM) // // 目标: 处理主窗口的消息。 // // WM_COMMAND - 处理应用程序菜单 // WM_PAINT - 绘制主窗口 // WM_DESTROY - 发送退出消息并返回 // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_COMMAND: { int wmId = LOWORD(wParam); // 分析菜单选择: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } } break; case WM_PAINT: {//case110 PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); // TODO: 在此处添加使用 hdc 的任何绘图代码... // wm01paint01(hWnd, ps, hdc);//每次重建窗口,则重新绘图 // EndPaint(hWnd, &ps); }//case110 break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } // “关于”框的消息处理程序。 INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; } break; } return (INT_PTR)FALSE; } ```