Responding to custom property changes.

G

Guest

I have implemented DashStyle and LineThickness for custom circle control as
follows:

Public Property DashStyle() As DashStyle
Get
Return m_DashStyle
End Get
Set(ByVal Value As DashStyle)
m_DashStyle = Value
End Set
End Property

<DefaultValue(1)> _
Public Property LineThickness() As Integer
Get
Return m_intLineThickness
End Get
Set(ByVal Value As Integer)
m_intLineThickness = Value
End Set
End Property

Now how can I make changes to these property take effect at design and run
time.

At design time any changes to these two property doesn’t take effect. The
circle remains same at design time.
 
A

Alexander Shirshov

How do you draw the circle? If you do it in Paint event then you could trigger
it by calling Invalidate() method after the property changes, i.e.
....
Set(ByVal Value As DashStyle)
m_DashStyle = Value
Invalidate()
End Set
 
G

Guest

Thanks Alexander.

Someone suggested me using Refresh() method after property changes. Does
refresh works differently from invalidate()?
 
A

Alexander Shirshov

Thanks Alexander.
Someone suggested me using Refresh() method after property changes.
Does refresh works differently from invalidate()?

This is what Refresh does:

public virtual void Refresh()
{
this.Invalidate(true);
this.Update();
}

It marks the control as invalid and then forces the redraw, while just calling
Invalidate() "enqeues" the redraw.

I guess there's no real difference in your case.

Alexander
 
G

Guest

Thanks

Alexander Shirshov said:
This is what Refresh does:

public virtual void Refresh()
{
this.Invalidate(true);
this.Update();
}

It marks the control as invalid and then forces the redraw, while just calling
Invalidate() "enqeues" the redraw.

I guess there's no real difference in your case.

Alexander
 

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