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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현