YauhenMardan

WinAPI_5_3_Car_func

Apr 5th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. void CreteCarRgn(HDC hDC, HRGN& hRgn, int x, int y, int width, int height, double angle)
  2. {
  3.     //Ellipse(hDC, x, y, x + width, y + height);
  4.     //begin
  5.     BeginPath(hDC);
  6.     //rotate
  7.     //make region
  8.     MoveToEx(hDC, (int)RotateX(x, y, angle), (int)RotateY(x, y, angle), NULL);
  9.     LineTo(hDC, (int)RotateX(x, y + 0.8*height, angle), (int)RotateY(x, y + 0.8*height, angle));
  10.     LineTo(hDC, (int)RotateX(x + width, y + 0.8*height, angle), (int)RotateY(x + width, y + 0.8*height, angle));
  11.     LineTo(hDC, (int)RotateX(x + width, y, angle), (int)RotateY(x + width, y, angle));
  12.     LineTo(hDC, (int)RotateX(x, y, angle), (int)RotateY(x, y, angle));
  13.     AngleArc(hDC, (int)RotateX(x, y + 0.9*height, angle), (int)RotateY(x, y + 0.9*height, angle), 0.1*height, 0, 360);
  14.     //AngleArc(hDC, (int)RotateX(x + width, y + 0.9*height, angle), (int)RotateY(x + width, y + 0.9*height, angle), 0.1*height, 0, 360);
  15.     //Ellipse(hDC, (int)RotateX(x, y + 0.8*height, angle), (int)RotateY(x, y + 0.8*height, angle), (int)RotateX(x + 0.2*width, y + height, angle), (int)RotateY(x + 0.2*width, y + height, angle));
  16.     //Ellipse(hDC, x + 0.8*width, y + 0.8*height, x + width, y + height);
  17.     CloseFigure(hDC);
  18.     //end
  19.     EndPath(hDC);
  20.     hRgn = PathToRegion(hDC);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment