Windows Develop Bookmark and Share   
 index > Windows Forms General > scrolling causes system to slow
 

scrolling causes system to slow

Hello

i have used a scroll bar to move an image. The problem is that when i use the scroll bar the program gets slow.

the paint handler which is used for painting in my program is this

Bitmap bitmap=new Bitmap("c\\temp\\image.bmp");

private void DrawArea_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
SolidBrush brush = new SolidBrush(Color.FromArgb(255, 255, 255));
g.FillRectangle(brush, this.ClientRectangle);
g.DrawImageUnscaled( bitmap, this.ClientRectangle.X , -OffSetY, bitmap.Width, bitmap.Height);
this.Refresh();
}

the vertical scroll bar handler which i have used so far is this

private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
offsety = e.NewValue;
}

Thanks
Regards
MS Chaudhary
MS Chaudhary  Wednesday, November 07, 2007 9:51 AM

the problem is that i was trying to load the image in bitmap format and when i refresh it takes time but when i loaded the jpg image it worked well...........

Thanks for all the responses

MS Chaudhary  Saturday, November 17, 2007 8:26 AM
Is "this.Refresh()" really needed?

What does the OnPaint() for the containing control look like?
Matthew Watson  Wednesday, November 07, 2007 10:49 AM

We are changing the issue type to “Comment�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.
Thank you!

Yu Guo â€?MSFT  Tuesday, November 13, 2007 2:03 AM

the problem is that i was trying to load the image in bitmap format and when i refresh it takes time but when i loaded the jpg image it worked well...........

Thanks for all the responses

MS Chaudhary  Saturday, November 17, 2007 8:26 AM

You can use google to search for other answers

Custom Search

More Threads

• Barcode reader problem
• form focusing after synchronous event
• Windows Application Launcher
• Performance problem with TIF
• datetimepicker and bindingsource problem
• Button looks different when the application is ran in different Machine.
• Show beyond the Form
• Uncheck all the items in a CheckedListBox?
• capture image of mschart controle in .net
• Maximum Timer Number in Form