Rectangle tool problem in a paint program

I've managed to create this rectangle tool in a painting program.
Whenever i click and drag the mouse pointer to the right-bottom axis
on the paint board, the rectangle draws itself normally.
And here comes the problem:
Whenever I try to click and drag the mouse pointer to the
left/left-bottom/left-up/right-up axis there isn't any drawing

Here's my rectangle code:
case "rectangle":
if (e.Button == MouseButtons.Left)
Graphics board = Graphics.FromImage(imageBitmap);
board.DrawImage(image, 0, 0);
myPen = new Pen(Variables.frontColor, Variables.linePattern);
board.DrawRectangle(myPen, Variables.oldX, Variables.oldY, e.X - Variables.oldX, e.Y - Variables.oldY);
Graphics canvas = lblPaintArea.CreateGraphics();
canvas.DrawImage(imageBitmap, 0, 0);
Graphics palette = Graphics.FromImage(image);
palette.DrawImage(imageBitmap, 0, 0);
Variables.oldX = e.X;
Variables.oldY = e.Y;


Thanks in advance for any help.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!