The following code is in the Handlescroll event:
Graphics _canvasGraphics = pictureBox1.CreateGraphics();
RectangleF clipRegion = new RectangleF(hScrollBar1.Value,
vScrollBar1.Value, (pictureBox1.Right - vScrollBar1.Width),
(pictureBox1.Bottom - hScrollBar1.Height));
_canvasGraphics.SetClip(clipRegion,System.Drawing. Drawing2D.CombineMode.
Replace);
_canvasGraphics.DrawImage(pictureBox1.Image,canvas Graphics.ClipBounds);
If i change the code to this it works fine:
Graphics _canvasGraphics = pictureBox1.CreateGraphics();
RectangleF clipRegion = new RectangleF(hScrollBar1.Value,
vScrollBar1.Value, (pictureBox1.Right - vScrollBar1.Width),
(pictureBox1.Bottom - hScrollBar1.Height));
_canvasGraphics.DrawImage(ModifiedBmp,new RectangleF(0, 0,
clipRegion.Width, clipRegion.Height),
clipRegion, GraphicsUnit.Pixel);
pictureBox1.Update();
_canvasGraphics.Dispose();
The problem is i need to set the clipping region in the graphics
class.....as u can see above i don't use the setclip at all......if i
try to set the clipping region at all then i cannot display the image.
The visible clipping region gets set to zero for some reason when i was
debugging it...can anyone see a way to fix this?.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!