user controls in compact framework 3.5

C

Chris

I am creating my own controls for compact framework 3.5. My control class
inherits from Control class. Then I override OnPaint method.
My question is about properties - imagine there is a property that changes
any graphic look of the control:

public bool MyProp
{
get {/*something*/}
set
{
_myprop=value;
this.Invalidate();
}
}


Is it a good idea to call Invalidate methos there? Of course I want to
repaint the control after setting the property (in design mode and runtime
mode as well).

Now, I have other problem - I have created my own combobox control.
Unfortunatelly, when the app is running, the control repaints oll the time
(OnPaint methid is being called all the time) why? can it be caused, that I
am calling Invalidate() method after setting each of the properties?
 
C

Chris Tacke, eMVP

Depends on how the properties are being used. Invalidate is going to force
an OnPaint call. If that in turn forces a change in a property, then you'll
have a loop of each calling the other and would certainly give you the
behavior you see.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top