Hi
I am trying to display a large image on the form and make the form
scrollable.
My image is about 4200 x 7000 pixel.
private void Form1_Paint(obj ect sender, System.Windows. Forms.PaintEven tArgs
e)
{
Graphics g=e.Graphics;
g.DrawImage(Ima ge,0,0,Image.Wi dth,Image.Heigh t);
}
The image display correctly and the scrolling works fine. However the
scrolling is not
smooth ( scrolling movement is jaggered ). Seems the image is not updated
fast enough.
I have tried with IE and photoshop to open the same image and both
application is able
to scroll the image quite smoothly. So far I have not seen any posted sample
that can scroll
large image smoothly.
I have even tried various method such as Clipping only the client region
using
Region r= new
Region(0,0,this .ClientRectangl e.Width,this.Cl ientRectangle.H eight);
g.Clip=r;
and using
Rectangle dr=new
Rectangle(0,0,t his.ClientRecta ngle.Width,this .ClientRectangl e.Height);
g.DrawImage(Ima ge,dr,dr,Graphi csUnit.Pixel);
but it stills does not achieve what I want.
Anyone have any idea how scroll very large image smoothly ?
Thanks
Danial
I am trying to display a large image on the form and make the form
scrollable.
My image is about 4200 x 7000 pixel.
private void Form1_Paint(obj ect sender, System.Windows. Forms.PaintEven tArgs
e)
{
Graphics g=e.Graphics;
g.DrawImage(Ima ge,0,0,Image.Wi dth,Image.Heigh t);
}
The image display correctly and the scrolling works fine. However the
scrolling is not
smooth ( scrolling movement is jaggered ). Seems the image is not updated
fast enough.
I have tried with IE and photoshop to open the same image and both
application is able
to scroll the image quite smoothly. So far I have not seen any posted sample
that can scroll
large image smoothly.
I have even tried various method such as Clipping only the client region
using
Region r= new
Region(0,0,this .ClientRectangl e.Width,this.Cl ientRectangle.H eight);
g.Clip=r;
and using
Rectangle dr=new
Rectangle(0,0,t his.ClientRecta ngle.Width,this .ClientRectangl e.Height);
g.DrawImage(Ima ge,dr,dr,Graphi csUnit.Pixel);
but it stills does not achieve what I want.
Anyone have any idea how scroll very large image smoothly ?
Thanks
Danial
Comment