Jump to content
  • Advertisement
Sign in to follow this  
Link

To make shaking a windows form

This topic is 4804 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I would make shaking a window form as Yahoo messanger chat make if the user click on a button. How can i do? Someone speak about DirectX, but where are expleining about? If the user of my application haven't got directx on its computer can i use other ways to do that? I use c# for VS 2003 Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Just move the window a few times. Do a random +/- 5 pixels of the x/y coords of the window.

Share this post


Link to post
Share on other sites
Just for the heck of it, in C/C++ I would do this, I'm sure you can get the
equivalent in C#:


    INT iX, iY;
    INT iIndex;
    RECT rcWindow;

    // Current window position.
    GetWindowRect(&rcWindow);
    for(iIndex = 0; iIndex < 160; iIndex ++)
    {
        iX = rand() % 6;
        iY = rand() % 6;

        // Offset the window position.
        SetWindowPos(NULL, rcWindow.left + iX,
            rcWindow.top + iY, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
    }

    // Restore the current position.
    SetWindowPos(NULL, rcWindow.left, rcWindow.top,
        0, 0, SWP_NOSIZE|SWP_NOZORDER);




It will not have anything to do with DirectX :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!