Hello,

i'm drawing a rectangle in my onpaint method, which id like to rotate around a certain point (mouse movement would rotate it - basically, one end of the rectangle would be static, the other would be change with mouse movement). Ive tried to look it up myself, but no success. So i am wondering if this is even possible, and if it is, how?

Thanks in advance

Sure it's possble.

Check out the RotateTransform method of the Graphics object.

Second way to do it is make a GrahicsPath object with your rectangle and rotate the path with the Matrix class out of the System.Drawing.Drawing2D namespace.

Thanks, ill look it up.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.