I'm trying to get my head around where to begin with this, I just want suggestions on approach and am not looking for code.
Basically what I need to do is "animate" some shapes on my main form.
what I want is something similar to the old XP stuff in dialogues etc like delete where a document flies to the other side or a glow along a network cable travels left to right.
In this case I only need it to be a basic shape, say a square or a ball and want it to go left to right and back again, no fancy animation, it doesn't need to be an image, just a basic filled shape of any colour.
simple motion <--------->.
Can anybody suggest a way to go about this?
I was thinking of creating a panel within which I can use the FillEllipse() (for a circle) or similar for a square, which I assume accept arguments for position?
// edit - this call takes the location parameters of the rectangle, so storing those in a variable perhaps in a loop with a bit of manipulation to them will help achieve the moving.
Sorry, which part was the edit referring to? I have no problems with the drawing and filling part already, was just unsure which part is relevant to sorting out the movement.
Am I right in thinking that the call to the draw function will accept position vectors in the form of the standard coordinate system so ican just keep drawing it in different places each time?
To copy & paste the rectangle drawing function from MSDN:
1 2 3 4 5 6 7
BOOL Rectangle(
HDC hdc,
int nLeftRect,
int nTopRect,
int nRightRect,
int nBottomRect
);
As you can see four integer parameters are taken - these paramters are described as:
nLeftRect
[in] Specifies the logical x-coordinate of the upper left corner of the rectangle.
nTopRect
[in] Specifies the logical y-coordinate of the upper left corner of the rectangle.
nRightRect
[in] Specifies the logical x-coordinate of the lower right corner of the rectangle.
nBottomRect
[in] Specifies the logical y-coordinate of the lower right corner of the rectangle.
So changing these should change the location of the rectangle.
Ah ok, im on my Android phone at the moment and couldn't get the site to load right, hence my confusion. Thanks for the c&p though. I'll try it out when I get back to my pc and let you know if I hit any snags.