Answered Essay: In Microsoft Visual Studio 2015 & using C# Programming what would the code look like for:

In Microsoft Visual Studio 2015 & using C# Programming what would the code look like for:

In this exercise, you’ll have far less instruction, and you’ll actually need to add a bit of code. In a separate solution (give the solution a name that makes sense), I want you to create a form that contains four square buttons arranged in a rectangular array (i.e., four buttons in the same of a rectangle). Each button should have a caption of “Push Me”. When the user clicks on a button, the button should disappear and the other three buttons should become or remain visible. I also want you to create a functioning Exit button underneath the rectangular array of four buttons. This button should also be set as the form’s CancelButton. Set the form’s AcceptButton to the button in the upper-left hand corner of your rectangular array.

Expert Answer

 

using System;
using System.Drawing;
using System.Windows.Forms;

namespace Demo
{
public partial class Buttons : Form
{
//Define button array of length 4.
Button[] btnArray = new Button[4];
public Buttons()
{
InitializeComponent();
addButtons();
}

private void addButtons()
{
//Horizontal and vertical position of buttons
int xPosition = 0, yPosition = 50;

for(int i = 0; i < 4; i++)
{
btnArray[i] = new Button();
btnArray[i].Size = new Size(70, 23);
btnArray[i].Text = “Push Me”;
btnArray[i].Location = new Point(xPosition, yPosition);
xPosition += 70;
this.Controls.Add(btnArray[i]); // Add button to form.

}

//Creating cancel button
Button cancelButton = new Button();
cancelButton.Size = new Size(70, 23);
cancelButton.Text = “Cancel”;
cancelButton.Location = new Point(90, 80);
this.Controls.Add(cancelButton);
cancelButton.Click += new EventHandler(cancel_Click);

//Creating accept button
Button acceptButton = new Button();
acceptButton.Size = new Size(70, 23);
acceptButton.Text = “Accept”;
acceptButton.Location = new Point(0, 0);
this.Controls.Add(acceptButton);

//Handling Button clicks
btnArray[0].Click += new EventHandler(button_Click_0);
btnArray[1].Click += new EventHandler(button_Click_1);
btnArray[2].Click += new EventHandler(button_Click_2);
btnArray[3].Click += new EventHandler(button_Click_3);
}

private void button_Click_0(object sender, EventArgs e)
{
Button btn = (Button)sender;
btn.Visible = false;
btnArray[1].Visible = true;
btnArray[2].Visible = true;
btnArray[3].Visible = true;
}
private void button_Click_1(object sender, EventArgs e)
{
Button btn = (Button)sender;
btn.Visible = false;
btnArray[3].Visible = true;
btnArray[0].Visible = true;
btnArray[2].Visible = true;
}
private void button_Click_2(object sender, EventArgs e)
{
Button btn = (Button)sender;
btn.Visible = false;
btnArray[0].Visible = true;
btnArray[1].Visible = true;
btnArray[3].Visible = true;
}
private void button_Click_3(object sender, EventArgs e)
{
Button btn = (Button)sender;
btn.Visible = false;
btnArray[0].Visible = true;
btnArray[1].Visible = true;
btnArray[2].Visible = true;
}

private void cancel_Click(object sender, EventArgs e)
{
Close();
}
}
}

OUTPUT-

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.