TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Giles Papworth
NA
33
0
Control Repaint
Oct 22 2009 6:19 AM
Hi all,
As you may have seen from one of my previous posts, i have a control that is used for a button. It paints a graphic on the paint method of the control.
When the mouse hovers over the control, it detects this and repaints it with the relevant image for the mouse hover. However it is taking quite some time for the repaint to happen.
I have set the double buffer to true and i have tried using this.Refresh() instaed of this.Invalidate() but only seeing a marginal difference in speed.
Is there anything i can do to speed this up?
The images have already been loaded into a local bitmap and then just simply drawn in place. The code is below:
if (this.Enabled)
{
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
try
{
switch (ControlState)
{
case ControlStateEnum.Normal:
e.Graphics.DrawImage(MouseNormalImage, 0, 0, Width, Height);
break;
case ControlStateEnum.Over:
e.Graphics.DrawImage(MouseHoverImage, 0, 0, Width, Height);
break;
}
}
catch { }
}
if anyone can think of a way of speeding this up that sould be great.
Cheers
Reply
Answers (
4
)
Form re-paint GDI+
GDI+ Buffered Image and redraw problem