企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
`` ``` case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); // TODO: 在此处添加使用 hdc 的任何绘图代码... // double slope = 0.6;// 0.75;// 当斜率大于1的时候,绘图要反转,即以y和 DeltaY为循环变量! //1.75;// 0.75;// deltY/deltX=1.45 即斜率(y2-y1)/(x2-x1)=1.75 int x100 = 1000;// 100; int x500 = 5000;// 500; int y100 = 1000;// 100; int y400 = 4000;// 400; MoveToEx(hdc, 50, 10, NULL); Rectangle(hdc, x100, y100, x500, y400); INT64 maxY; maxY = 2 ^ 63 - 1; INT64 x1 = 100; double dx1 = (double)x1; INT64 x2 = x1; double dx2 = (double)x2; INT64 y1 = 100; double dy1 = (double)y1; INT64 y2 = y1; double dy2 = (double)y2; int flagx = 1; int flagy = 1; int flagy0 = 0;// -1; //flagy0比较晦涩难懂, 有时精密计算的结果是 y2多次等于边界 y400等,当是第一次的时候 就反转 // for (INT64 ii = 100; ii < 99999; ++ii) {//for110 //x1 = ixi;// / 10; //精密到 0.1 //dx1 = (double)x1; aboutFlag: //x1 = (int)dx1; if (x100 >= (x1/1) ) { //if (100 == (x1/10) ) { flagx = 1; } if (x500 <= (x1/1)) {//if (x500 == (x1/10)) { flagx = -1; } y1 = (int)dy1;//把y的坐标找出来变成整数 if (y100 >= y1) {//if (y100 == y1) { flagy = 1; } //if (0==flagy0 && y400 == (int)(y1/1) ) { //if (y400 == (int)(y1/10) || (4000==(int)y1 ) ) { if ( y400 <= (int)y1) { //(int)(y1 / 1)) { flagy = -1; flagy0 = 2; } if (100 == x1 && 100 == y1) { flagx = 1; flagy = 1; } //这个点特殊,这是光源,或笛卡尔坐标原点 //aboutFlag-End; label_Y_as_aVar: x2 = x1 + (flagx) * 1; dx2 = dx1 + (flagx) * 1; INT64 deltaX = labs(long(x2 - x1)); dy2 = (flagy)*deltaX*slope + dy1; // SetPixel(hdc, (x2/1), (int)(dy2/1), RGB(1, 200, 0)); // SetPixel(hdc, (x2/10), (int)(dy2/10), RGB(1, 200, 0)); // labelEnd990: x1 = x2; dx1 = dx2; if (y1 != y2) { flagy0 = 0; }//此举回复反转开关 y1 = y2; dy1 = dy2; }//for110 // // EndPaint(hWnd, &ps); }//case WM_PAINT: break; //......省略 // case WM_DESTROY: ```