Question: 1 1 . Answer these questions about or modify our class code ( look on Blackboard. a . Which statement does a toggle? b .

11. Answer these questions about or modify our class code(look on Blackboard.
a. Which statement does a toggle?
b. Write code that changes the timer start button text Stop timer. Then when pressed again the button stops the Timer and changes the text back to Start Timer. So the timer button toggles on and off.
c. Add the checkers to the board as below:
To place an image use this syntax:
Graphics.DrawImage(RedChecker, x,y,width,height)
- Use BlackChecker for the black checkers.
Make annotations in the code.
{public partial class Form1 : Form
{
int numseconds =10;
public Form1()
{
InitializeComponent();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Random r = new Random(15);
Graphics ourgraphics;
ourgraphics = e.Graphics;
SolidBrush backbrush = new SolidBrush(Color.Silver);
ourgraphics.FillRectangle(backbrush,200,350,410,410);
SolidBrush boardbrush = new SolidBrush(Color.Red);
int xcoord,ycoord;
Boolean redflag = false;
int squaresize =48;
for (int j =1; j =4;j++){
xcoord =200;
for (int i =1; i =8; i++)
{
ycoord = j *(squaresize+4)+300;
if (redflag)
{
boardbrush = new SolidBrush(Color.Red);
} else
{
boardbrush = new SolidBrush(Color.Black);
}
ourgraphics.FillRectangle(boardbrush, xcoord, ycoord, squaresize, squaresize);
xcoord = xcoord + squaresize+4;
redflag =!redflag;
}
redflag =!redflag;
}
// factor1=10%, factor2=20% factor2=30%, factor4=40%
int[] percentages={10,20,30,40};
Color[] colors ={ Color.Orange,Color.Bisque, Color.Navy, Color.Aquamarine };
// rewrite the code to generate the pie chart
int startangle =0;
int alpha =100;
for (int j =0; j 10; j++)
{
startangle +=1;
SolidBrush piebrush;
int current_angle = startangle;
for (int i =0; i percentages.Length; i++)
{
//piebrush = new SolidBrush(colors[i]);
//int red = piebrush.Color.R +1;
//int green = piebrush.Color.G +1;
//int blue = piebrush.Color.B+1;
//if (red >255){ red =255; }
//if (green >255){ green =255; }
//if (blue >255){ blue =255; }
//if (alpha0){ alpha =0; }
int red = r.Next(0,255);
int green = r.Next(0,255);
int blue = r.Next(0,255);
piebrush = new SolidBrush(Color.FromArgb(alpha,red, green, blue));
colors[i]= piebrush.Color;
double sweepangle =360*((double)percentages[i]/100);
ourgraphics.FillPie(piebrush,300,10,200,200, current_angle, (int)sweepangle);
current_angle +=(int)sweepangle;
}
Thread.Sleep(3000);
}
//SolidBrush factor1= new SolidBrush(Color.Orange);
//SolidBrush factor2= new SolidBrush(Color.Bisque);
//SolidBrush factor3= new SolidBrush(Color.Navy);
//SolidBrush factor4= new SolidBrush(Color.Aquamarine);
//ourgraphics.FillPie(factor1,300,10,200,200,0,36);
//ourgraphics.FillPie(factor2,300,10,200,200,36,72);
//ourgraphics.FillPie(factor3,300,10,200,200,108,108);
//ourgraphics.FillPie(factor4,300,10,200,200,216,144);
}
private void timer1_Tick(object sender, EventArgs e)
{
numseconds = numseconds -1;
button1.Text = numseconds.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
}
}
 11. Answer these questions about or modify our class code(look on

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!