Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

How do I draw a rotated bitmap (Windows Forms)?

$
0
0

I have car sprites in a game (2-D top down) where I have a single bitmap of the car (24x24 PNG with alpha). I track the location of the car by the midpoint of the sprite (11, 11) and the orientation by the degrees it is rotated (0..359).

When I draw the image to the windows (this is a Forms app), how can I draw it with the rotation, handling the fact that the bitmap bounds can be as great as 34x34 (45 degree angle)?

The three question in this are:

  1. How do I tell it the angle to rotate in the draw?
  2. What is the location of the upper left corner for the draw (or can I give it the center)?
  3. What are the dimensions for the draw (or can I tell it to map 1 bitmap pixel to 1 pixel on the screen)?

thanks - dave


Who will win The Windward International Collegiate Programming Championships?


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>