Dustin Cooper
Dustin Cooper

Reputation: 43

Override designer property value

I have a control that has been used on many forms.

This control has a forecolor property that has had its color set different on many of the forms it is used on.

I want to know if there is an easy way I can set this forecolor property to the same value on all the forms without going through all the forms individually as there is 200+ forms

Upvotes: 1

Views: 82

Answers (1)

Luaan
Luaan

Reputation: 63732

There's many ways to do this. The simplest would be to override the property itself:

public override Color ForeColor
{
  get { return Color.Aqua; }
  set { }
}

You could also hook an event handler on ForeColorChanged and change it back, or you could override the OnForeColor method.

Upvotes: 1

Related Questions