Owner Draw Control Problems
-
I've created a number of overdrawn controls (status bar, group box) and they drawn fine, and as i want. However if you move another window over the window with these controls, you get odd kinda painting on the controls, kinda like window borders left over, etc. I would guess by getting all the controls to redraw themeselves would work, but I can't seem to get this sorted. i tried overidding the OnGotFocus in the main form on which these controls reside to call Invalidate(true), but it doesn't seem to work. Any ideas?? [Edit] I've managed to solve this by calling the Invalidate in the Frosm Activate event. However I still the same problem when say a drop down box (an owner drawn one) drops the list over the owner drawn controls. is there anyway of solving this short of calling invalidate alot, which. All the owner drawing is done by overriding the OnPaint in the pretty standard way. [/Edit]
-
I've created a number of overdrawn controls (status bar, group box) and they drawn fine, and as i want. However if you move another window over the window with these controls, you get odd kinda painting on the controls, kinda like window borders left over, etc. I would guess by getting all the controls to redraw themeselves would work, but I can't seem to get this sorted. i tried overidding the OnGotFocus in the main form on which these controls reside to call Invalidate(true), but it doesn't seem to work. Any ideas?? [Edit] I've managed to solve this by calling the Invalidate in the Frosm Activate event. However I still the same problem when say a drop down box (an owner drawn one) drops the list over the owner drawn controls. is there anyway of solving this short of calling invalidate alot, which. All the owner drawing is done by overriding the OnPaint in the pretty standard way. [/Edit]
You need to do this in the constructor:
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer,true);"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi -
You need to do this in the constructor:
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer,true);"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma GandhiThere all ready set in the constructor. Thats why it's puzzling me a little.
-
There all ready set in the constructor. Thats why it's puzzling me a little.
You don't know how many times I've gone through owner draw problems like this. That's why I'm glad we're now re-implementing all Windows controls from scratch[^], with full owner draw/skinning capabilities. I've been named design leader for the project.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi -
You don't know how many times I've gone through owner draw problems like this. That's why I'm glad we're now re-implementing all Windows controls from scratch[^], with full owner draw/skinning capabilities. I've been named design leader for the project.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma GandhiSounds like a good idea. I'll be sure to follow the project. Will you guys be posting your progress? if you want testers in the future let me know.