Hello i have an image that can be move using arrow keys.
Problem is image is behind the group box.
Question: How can I make this image visible within the group box?
HELP. c#.
I only use the toolbox to make my groupbox.
Problem is image is behind the group box.
Question: How can I make this image visible within the group box?
HELP. c#.
I only use the toolbox to make my groupbox.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CheeseMaze
{
public partial class Game1 : Form
{
PictureBox mouse = new PictureBox();
public Game1()
{
InitializeComponent();
mouse.BackColor = Color.Red;
//mouse.ImageLocation = "rat.png";
mouse.Size = new Size(20, 20);
mouse.Location = new Point(20, 25);
this.Controls.Add(mouse);
this.KeyDown += new KeyEventHandler(Game1_KeyDown);
}
void Game1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Left)
{
mouse.Location = new Point(mouse.Location.X - 1, mouse.Location.Y);
}
if (e.KeyData == Keys.Right)
{
mouse.Location = new Point(mouse.Location.X + 1, mouse.Location.Y);
}
if (e.KeyData == Keys.Up)
{
mouse.Location = new Point(mouse.Location.X, mouse.Location.Y - 1);
}
if (e.KeyData == Keys.Down)
{
mouse.Location = new Point(mouse.Location.X, mouse.Location.Y + 1);
}
}
}
}