Simon asked:
Hi, Sorry... this is a bit above me… Are you able to do a quick example? It would be really appreciated. Best regards,
Simon
This is a separate question related to the interactive behavior of graphics, in response to some input event. I already described the principle in my past answers referenced in Solution 1.
The schema of the solution may look something like
using System.Windows.Forms;
using System.Drawing;
class MyControl : Control {
static readonly double Increment = System.Math.PI * 5;
double RotationAngle;
protected override void OnMouseDown(MouseEventArgs e) {
RotationAngle += Increment;
Invalidate();
}
protected override void OnPaint(PaintEventArgs e) {
var matrix = new System.Drawing.Drawing2D.Matrix();
PointF centerOfRotation = new System.Drawing.PointF();
matrix.Rotate(RotationAngle, centerOfRotation);
e.Graphics.Transform = matrix;
e.Graphics.ResetTransform();
}
}
Sorry for showing C# code, not VB.NET; I just don't want to waste time for it. You can easily translated it to VB.NET by yourself, manually or using many of the available tools. You only need to understand the principles.
You can add a lot of detail: limit the area where you respond to mouse click, make the increment value depending on some factors, invalidate only certain region or rectangle inside the client area of the control, and so on.
—SA