G
Guest
I have a bitmap of 100X100. On the load, the bitmap is created by a function
(createimage()). On my OnPaint, I draw the image back to the screen
(e.Graphics.DrawImage( bitmap, destrect)).
Now, I want to add a button. When user click on it, I want the bitmap shift
to the left by 10% and fill the new area with new information requested.
Here is the code I have in the button handler:
if (bitmap == null) return;
Graphics graphics = Graphics.FromImage(bitmap);
Matrix X = new Matrix();
X.Translate(10, 0);
graphics.Transform = X;
Pen myPen = new Pen(Color.Red, 1);
graphics.DrawLine(myPen, 90, 0, 100, 100);
graphics.Dispose();
Invalidate();
The problem here is that I don't see any translation of my bitmap. Can
someone point me where the problem is?
Thanks in advance,
Anthony
(createimage()). On my OnPaint, I draw the image back to the screen
(e.Graphics.DrawImage( bitmap, destrect)).
Now, I want to add a button. When user click on it, I want the bitmap shift
to the left by 10% and fill the new area with new information requested.
Here is the code I have in the button handler:
if (bitmap == null) return;
Graphics graphics = Graphics.FromImage(bitmap);
Matrix X = new Matrix();
X.Translate(10, 0);
graphics.Transform = X;
Pen myPen = new Pen(Color.Red, 1);
graphics.DrawLine(myPen, 90, 0, 100, 100);
graphics.Dispose();
Invalidate();
The problem here is that I don't see any translation of my bitmap. Can
someone point me where the problem is?
Thanks in advance,
Anthony