https://github.com/karpovpaulus/frogwindowsformsapp
🎮 🐸 The game "Frogs", written in the process of learning Windows Forms technology and working with images.
https://github.com/karpovpaulus/frogwindowsformsapp
winforms
Last synced: 3 months ago
JSON representation
🎮 🐸 The game "Frogs", written in the process of learning Windows Forms technology and working with images.
- Host: GitHub
- URL: https://github.com/karpovpaulus/frogwindowsformsapp
- Owner: KarpovPaulus
- Created: 2024-04-26T16:38:50.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-15T13:26:17.000Z (about 2 years ago)
- Last Synced: 2025-03-04T20:46:00.139Z (over 1 year ago)
- Topics: winforms
- Language: C#
- Homepage:
- Size: 170 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🐸 FrogWindowsFormsApp
## 🎮 🐸 The game "Frogs", written in the process of learning Windows Forms technology and working with images.

## 🔧 Technical part
* The project is implemented on the Windows Forms platform.
* Use the PictureBox component to work with images.
## 🌆 Working with images
~~~ csharp
private void PictureBox_Click(object sender, EventArgs e)
{
Swap((PictureBox)sender);
if(EndGame())
{
if(CanBeBetter(Convert.ToInt32(scoreLabel.Text)))
{
MessageBox.Show("Лучший результат!");
}
else
{
var result = MessageBox.Show("Можно лучше. Попробовать еще?", "Конец игры", MessageBoxButtons.YesNo);
if(result == DialogResult.Yes)
{
Application.Restart();
}
}
}
}
private void Swap(PictureBox clickedPicture)
{
var distance = Math.Abs(clickedPicture.Location.X - emptyPictureBox.Location.X) / emptyPictureBox.Size.Width;
if (distance > 2)
{
MessageBox.Show("Так нельзя");
}
else
{
var location = clickedPicture.Location;
clickedPicture.Location = emptyPictureBox.Location;
emptyPictureBox.Location = location;
scoreLabel.Text = Convert.ToString(Convert.ToInt32(scoreLabel.Text) + 1);
}
}
~~~~