How to change Backgroundimage location in windows Forms

Asked

Viewed 75 times

0

I have a Picturebox object that has an image set and behind it I put a background but I can’t change the background position

 pb.ImageLocation = Directory.GetCurrentDirectory() + @"\..\..\img\copovazio.png"; 

I wanted to do something like pb.BackgroundImage.Location

inserir a descrição da imagem aqui

This image is composed by one that makes the glass transparent and a blue texture that makes the water. I wanted to move that texture underneath to make the water rise and fall

1 answer

0


The control of the image is very limited, what I’ve researched that can be done is to override the image drawing event like this:

private void myButton_Paint(object sender, PaintEventArgs e)
{
    e.Graphics.DrawImage(myImage, myButton.ClientRectangle);
}

So you can use Textalign and Padding to counter the image movement.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.