Zerox
Zerox

Reputation: 63

Moving a GID shape righ and left

I use this code to move the shape up and down (viewport is the place I draw the shape)

float zoom = -viewport.Height * 0.20f;

viewport.Offset(2f, zoom);

Invalidate();

I want also to move it right and left, but I can't figure it out

Upvotes: 0

Views: 65

Answers (1)

Moha Dehghan
Moha Dehghan

Reputation: 18443

The Offset method moved the rectangle both horizontally and vertically, by the amounts you specify in the parameters.

You passed 2f as the first parameter of the Offset method, which is responsible for horizontal (left and right) movement of the rectangle. Just pass the amount you need, and you are done.

Upvotes: 1

Related Questions