C# Logical Schema

Joined
Dec 22, 2024
Messages
1
Reaction score
0
Please help, I need a Logical schema after the code below
A number is initialized to 0 and displayed.
When a button is pressed, the existing number is incremented by 10 and displayed.
If the number reaches 100, it is decremented by 10 until it reaches 0.
If the number reaches 0, it is incremented by 10 until it reaches 100.
The program continues this way until it is exited.

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

namespace l2
{
public partial class Form1 : Form
{
int count = 0, sp = 5, x0 = 25, y0 = 300, y1 = 301;
bool sem = true;

public Form1()
{
InitializeComponent();
}

private void label1_Click(object sender, EventArgs e)
{
}

private void button1_Click(object sender, EventArgs e)
{
using (Graphics desen = this.CreateGraphics())
{
using (SolidBrush pensula_albastra = new SolidBrush(Color.Blue))
using (SolidBrush radiera = new SolidBrush(this.BackColor))
{
desen.FillRectangle(radiera, x0, y0, sp, y1 - y0);

if (sem)
{
if (count < 100)
{
count += 10;
label1.Text = count.ToString();
y0 -= 10;
}
else
{
sem = false;
count -= 10;
label1.Text = count.ToString();
y0 += 10;
}
}
else
{
if (count > 0)
{
count -= 10;
label1.Text = count.ToString();
y0 += 10;
}
else
{
sem = true;
count += 10;
label1.Text = count.ToString();
y0 -= 10;
}
}

desen.FillRectangle(pensula_albastra, x0, y0, sp, y1 - y0);
}
}

x0 += 9;
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,573
Members
47,205
Latest member
ElwoodDurh

Latest Threads

Top