Вот код
| Код | LRESULT CALLBACK MAIN_PROC(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; char str[20]; int col; int cxClient, cyClient ; HDC hdc ; int x,y; char s[20]; char si[10]; char sx[10],sy[10]; PAINTSTRUCT ps ; bool b = false; switch (message) { case WM_INITDIALOG: return TRUE;
case WM_PAINT: if(b == true) { cxClient = LOWORD (wParam) ; cyClient = HIWORD (wParam) ; hdc = BeginPaint (hDlg, &ps) ; for(int i=0;i<10;i++) { x = rand()%200; y = rand()%200; itoa(i,si,10); point.Create(30); point.array[i].X = x; point.array[i].Y = y; TextOut(hdc, x, y, (LPCTSTR)si, 1); Ellipse (hdc,x-2,y-2,x+2,y+2) ; //-------------------// itoa(point.array[i].X,sx,10); itoa(point.array[i].Y,sy,10); strcpy(s, si); strcat(s, " ->"); strcat(s, "("); strcat(s, sx); strcat(s, ";"); strcat(s, sy); strcat(s, ")"); str[strlen(s+1)] = '\0'; SendDlgItemMessage(hDlg,IDC_LIST2,LB_ADDSTRING, 0, (LPARAM)s); //-------------------// } } EndPaint (hDlg, &ps) ;
return 0 ;
case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); if (LOWORD(wParam) == IDCANCEL) //если нажата кнопка Exit { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } // Parse the menu selections: switch (wmId) { case IDM_ABOUT: break;
case IDM_EXIT: DestroyWindow(hDlg); break;
case IDOK2: GetDlgItemText(hDlg, IDC_EDIT1, str, 20); col = atoi(str); b = true; return 1; default: return DefWindowProc(hDlg, message, wParam, lParam); } break; } return FALSE; }
|
проблема в следущем мне надо в обраобтке кнопки IDOK2 вызвать Paint для рисования элипсов!!! так вот как это сделать??? |