I think I see what you're trying to do. Your picturebox click handler is storing the left point when the user left clicks and the right point when the user right clicks. Then when the button is clicked you are moving the pixels between the bounding box defined by those 2 points but into a second picture box. An interesting approach but let's solve the problem that you have.
I believe your picturebox click logic is fine so I'm ignoring that. However I still believe you're missing some information here. You are identifying the bounding box in PB1 with the left/right mouse clicks but you aren't specifying where inside PB2 to draw the new image. Here's the logic of your algorithm.
- Get the width and height of the source image.
- Get the starting point and the offset to use. Hence if the user selects starting point (10,20) and then clicks point (40, 30) then the image is being shifted over 40 and down 30 starting with point (10, 20) until the end of the image.
Based upon your original post it sounds like what you are trying to do is move the entire image, not from the starting point on. Thus your starting point is really just a reference point on the first image and the second click is used to get the offset that you want to move the image. Is that a correct assessment of what you want?
If so then your button click just needs to get the offset given the first and second points. Then apply the offset to every pixel in the original image to move the entire image the given offset. Since you're using a picturebox here you can actually just adjust the padding of the image based upon the offset to get it to render in the second control correctly. Of course if you actually wanted to change the image then it would require you transforming the image.
private void button1_Click ( object sender, EventArgs e )
{
int x2 = Convert.ToInt32(textBox1.Text);
int y2 = Convert.ToInt32(textBox2.Text);
int Tx = Convert.ToInt32(textBox3.Text);
int Ty = Convert.ToInt32(textBox4.Text);
//Get the offset from the first and second points
int offsetX = Tx - x2;
int offsetY = Ty - y2;
//Create a new image of the same size as the original image
var source = pictureBox1.Image;
var target = new Bitmap(source);
//Use padding to offset the original image in the control
pictureBox2.Padding = new Padding(offsetX, offsetY, 0, 0);
pictureBox2.Image = target;
}