2024-11-23 15:53:01
void drawExp(HWND hWnd){
static RECT rc; if(rc.right==0) GetClientRect(hWnd,&rc);
static float w=rc.right, h=rc.bottom, xo=w/2-w/4, yo=h/2+h/4;
HDC hdc=GetDC(hWnd);
SetGraphicsMode(hdc,GM_ADVANCED);
SetMapMode(hdc, MM_LOENGLISH);
SetViewportOrgEx(hdc,xo,yo,0L);
MoveToEx(hdc,-w/2 +140,0,0L); LineTo(hdc,w, 0); MoveToEx(hdc,0,-h/2+80,0L); LineTo(hdc,0,h/2+ 80);
float r=100;
float x=-w/2 +160, y=0; xo=x; yo=exp(-x/200)*r; MoveToEx(hdc,xo,yo,0L);
float dx=1;
do{
x+=dx; y=exp(-x/200)*r;
LineTo(hdc,x,y);
xo=x, yo=y; }while(x<w);
ReleaseDC(hWnd,hdc); }