How to reset the location of multiple buttons in a form when one button is movedHow do I group Windows Form radio buttons?How to void overlap of 2 images when drag and drop in C#?Drag and drop an image in WPFHow and when to use ‘async’ and ‘await’C# Click source detectionHow does the Post back get reset ?Cannot delete a datagrid row and save the remaining rows back in databasehow to download the azure blob snapshots using c sharp in windows form applicationReturn from BackgroundWorker.DoWork throws TargetInvocationExceptionIn C# how to open third form inside first form when i click a button of the second form

Boss making me feel guilty for leaving the company at the end of my internship

Can a 40amp breaker be used safely and without issue with a 40amp device on 6AWG wire?

In The Incredibles 2, why does Screenslaver's name use a pun on something that doesn't exist in the 1950s pastiche?

Why not make one big cpu core?

Is pointing finger in meeting consider bad?

Would a bit of grease on overhead door cables or bearings cause the springs to break?

Why did the AvroCar fail to fly above 3 feet?

Parsing text written the millitext font

Can Mage Hand be used to indirectly trigger an attack?

How effective would a full set of plate armor be against wild animals found in temperate regions (bears, snakes, wolves)?

ISP is not hashing the password I log in with online. Should I take any action?

New Site Design!

Is it ethical to cite a reviewer's papers even if they are rather irrelevant?

Nth term of Van Eck Sequence

Why is it bad to use your whole foot in rock climbing

Is there a term for someone whose preferred policies are a mix of Left and Right?

Why does there seem to be an extreme lack of public trashcans in Taiwan?

What game uses dice with compass point arrows, forbidden signs, explosions, arrows and targeting reticles?

Does an African-American baby born in Youngstown, Ohio have a higher infant mortality rate than a baby born in Iran?

Is all-caps blackletter no longer taboo?

Can I get a photo of an Ancient Arrow?

How can I find out about the game world without meta-influencing it?

Any gotchas in buying second-hand sanitary ware?

How can this shape perfectly cover a cube?



How to reset the location of multiple buttons in a form when one button is moved


How do I group Windows Form radio buttons?How to void overlap of 2 images when drag and drop in C#?Drag and drop an image in WPFHow and when to use ‘async’ and ‘await’C# Click source detectionHow does the Post back get reset ?Cannot delete a datagrid row and save the remaining rows back in databasehow to download the azure blob snapshots using c sharp in windows form applicationReturn from BackgroundWorker.DoWork throws TargetInvocationExceptionIn C# how to open third form inside first form when i click a button of the second form






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-1















I'm making a drag and drop game for my A level computing coursework. My drag and drop works fine, but I have 6 buttons/options and I want to reset the locations on the other 5 buttons when I move on the 1 button. The 6 buttons are named btnAnswer1, btnAnswer2, btnAnswer3, etc.



I already tried to search for a solution, and it still doesn't work



bool isDragged = false;
Point ptOffset;
private void buttonMouseDown(object sender, MouseEventArgs e)
Button theButton = (Button)sender;
if (e.Button == MouseButtons.Left)
isDragged = true;
Point ptStartPosition = theButton.PointToScreen(new Point(e.X, e.Y));

ptOffset = new Point();
ptOffset.X = theButton.Location.X - ptStartPosition.X;
ptOffset.Y = theButton.Location.Y - ptStartPosition.Y;
else
isDragged = false;



private void buttonMouseMove(object sender, MouseEventArgs e)
Button theButton = (Button)sender;
if (isDragged)
Point newPoint = theButton.PointToScreen(new Point(e.X, e.Y));
newPoint.Offset(ptOffset);
theButton.Location = newPoint;



private void buttonMouseUp(object sender, MouseEventArgs e)
Button theButton = (Button)sender;
isDragged = false;

if ((theButton.Location.X >= 190 && theButton.Location.X <= 468) && (theButton.Location.Y >= 42 && theButton.Location.Y <= 236))
answerText = theButton.Text;
if (answerText == RandomQuestion[0].CorrectAnswerPosition)
MessageBox.Show("Correct Answer");

else MessageBox.Show("Wrong Answer");
// disableDragDrop();




I don't know how to reset the locations of the other 5 buttons when I move 1 button.










share|improve this question






























    -1















    I'm making a drag and drop game for my A level computing coursework. My drag and drop works fine, but I have 6 buttons/options and I want to reset the locations on the other 5 buttons when I move on the 1 button. The 6 buttons are named btnAnswer1, btnAnswer2, btnAnswer3, etc.



    I already tried to search for a solution, and it still doesn't work



    bool isDragged = false;
    Point ptOffset;
    private void buttonMouseDown(object sender, MouseEventArgs e)
    Button theButton = (Button)sender;
    if (e.Button == MouseButtons.Left)
    isDragged = true;
    Point ptStartPosition = theButton.PointToScreen(new Point(e.X, e.Y));

    ptOffset = new Point();
    ptOffset.X = theButton.Location.X - ptStartPosition.X;
    ptOffset.Y = theButton.Location.Y - ptStartPosition.Y;
    else
    isDragged = false;



    private void buttonMouseMove(object sender, MouseEventArgs e)
    Button theButton = (Button)sender;
    if (isDragged)
    Point newPoint = theButton.PointToScreen(new Point(e.X, e.Y));
    newPoint.Offset(ptOffset);
    theButton.Location = newPoint;



    private void buttonMouseUp(object sender, MouseEventArgs e)
    Button theButton = (Button)sender;
    isDragged = false;

    if ((theButton.Location.X >= 190 && theButton.Location.X <= 468) && (theButton.Location.Y >= 42 && theButton.Location.Y <= 236))
    answerText = theButton.Text;
    if (answerText == RandomQuestion[0].CorrectAnswerPosition)
    MessageBox.Show("Correct Answer");

    else MessageBox.Show("Wrong Answer");
    // disableDragDrop();




    I don't know how to reset the locations of the other 5 buttons when I move 1 button.










    share|improve this question


























      -1












      -1








      -1








      I'm making a drag and drop game for my A level computing coursework. My drag and drop works fine, but I have 6 buttons/options and I want to reset the locations on the other 5 buttons when I move on the 1 button. The 6 buttons are named btnAnswer1, btnAnswer2, btnAnswer3, etc.



      I already tried to search for a solution, and it still doesn't work



      bool isDragged = false;
      Point ptOffset;
      private void buttonMouseDown(object sender, MouseEventArgs e)
      Button theButton = (Button)sender;
      if (e.Button == MouseButtons.Left)
      isDragged = true;
      Point ptStartPosition = theButton.PointToScreen(new Point(e.X, e.Y));

      ptOffset = new Point();
      ptOffset.X = theButton.Location.X - ptStartPosition.X;
      ptOffset.Y = theButton.Location.Y - ptStartPosition.Y;
      else
      isDragged = false;



      private void buttonMouseMove(object sender, MouseEventArgs e)
      Button theButton = (Button)sender;
      if (isDragged)
      Point newPoint = theButton.PointToScreen(new Point(e.X, e.Y));
      newPoint.Offset(ptOffset);
      theButton.Location = newPoint;



      private void buttonMouseUp(object sender, MouseEventArgs e)
      Button theButton = (Button)sender;
      isDragged = false;

      if ((theButton.Location.X >= 190 && theButton.Location.X <= 468) && (theButton.Location.Y >= 42 && theButton.Location.Y <= 236))
      answerText = theButton.Text;
      if (answerText == RandomQuestion[0].CorrectAnswerPosition)
      MessageBox.Show("Correct Answer");

      else MessageBox.Show("Wrong Answer");
      // disableDragDrop();




      I don't know how to reset the locations of the other 5 buttons when I move 1 button.










      share|improve this question
















      I'm making a drag and drop game for my A level computing coursework. My drag and drop works fine, but I have 6 buttons/options and I want to reset the locations on the other 5 buttons when I move on the 1 button. The 6 buttons are named btnAnswer1, btnAnswer2, btnAnswer3, etc.



      I already tried to search for a solution, and it still doesn't work



      bool isDragged = false;
      Point ptOffset;
      private void buttonMouseDown(object sender, MouseEventArgs e)
      Button theButton = (Button)sender;
      if (e.Button == MouseButtons.Left)
      isDragged = true;
      Point ptStartPosition = theButton.PointToScreen(new Point(e.X, e.Y));

      ptOffset = new Point();
      ptOffset.X = theButton.Location.X - ptStartPosition.X;
      ptOffset.Y = theButton.Location.Y - ptStartPosition.Y;
      else
      isDragged = false;



      private void buttonMouseMove(object sender, MouseEventArgs e)
      Button theButton = (Button)sender;
      if (isDragged)
      Point newPoint = theButton.PointToScreen(new Point(e.X, e.Y));
      newPoint.Offset(ptOffset);
      theButton.Location = newPoint;



      private void buttonMouseUp(object sender, MouseEventArgs e)
      Button theButton = (Button)sender;
      isDragged = false;

      if ((theButton.Location.X >= 190 && theButton.Location.X <= 468) && (theButton.Location.Y >= 42 && theButton.Location.Y <= 236))
      answerText = theButton.Text;
      if (answerText == RandomQuestion[0].CorrectAnswerPosition)
      MessageBox.Show("Correct Answer");

      else MessageBox.Show("Wrong Answer");
      // disableDragDrop();




      I don't know how to reset the locations of the other 5 buttons when I move 1 button.







      c# drag-and-drop






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 2:12









      karel

      2,43492832




      2,43492832










      asked Mar 25 at 1:20









      joejoe

      113




      113






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You can change the button off postion this way



           yourButton.Location = new Point(50, 50); //x and y cordinate off position


          You should rest your 5 buttons positions in the method where you move 1 button with my method. Hope this helps.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330202%2fhow-to-reset-the-location-of-multiple-buttons-in-a-form-when-one-button-is-moved%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You can change the button off postion this way



             yourButton.Location = new Point(50, 50); //x and y cordinate off position


            You should rest your 5 buttons positions in the method where you move 1 button with my method. Hope this helps.






            share|improve this answer



























              0














              You can change the button off postion this way



               yourButton.Location = new Point(50, 50); //x and y cordinate off position


              You should rest your 5 buttons positions in the method where you move 1 button with my method. Hope this helps.






              share|improve this answer

























                0












                0








                0







                You can change the button off postion this way



                 yourButton.Location = new Point(50, 50); //x and y cordinate off position


                You should rest your 5 buttons positions in the method where you move 1 button with my method. Hope this helps.






                share|improve this answer













                You can change the button off postion this way



                 yourButton.Location = new Point(50, 50); //x and y cordinate off position


                You should rest your 5 buttons positions in the method where you move 1 button with my method. Hope this helps.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 25 at 2:11









                Junior CortenbachJunior Cortenbach

                164112




                164112





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330202%2fhow-to-reset-the-location-of-multiple-buttons-in-a-form-when-one-button-is-moved%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript