17
Answers

Form re-paint GDI+

Giles Papworth

Giles Papworth

15y
5.1k
1
I have a form which i am painting a custom interface for (I.E Skinning it)

However i have one issue which is:

I am painting the title bar, minimize, maximize and close buttons manually. I paint these on using the graphics object and all looks fine and dandy. However i have one small issue. When someone hovers over say the close button i need to change the image that has been painted in that area. The only way i can see to do this is:

1. create a picture boxe in the location for the close button and change the image depending on the mouse state which could be clunky.
2. repaint the form and paint the correct image in its place. However repainting the entire form for just one button state is a bit heavy and could be very slow. Although it would give me what i want it would not give the user a good experience in the app.

Is there any way of re-painting just a specific area of the form or do i really have to go with a picturebox and change the image depending on the mouse state?

Cheers
Answers (17)