Это прекрасно работает с большинством всех элементов управления, но я не могу представить свойство ImageIndex. Я не верю, что мне нужен доступ к ImageIndexConverter из моего кода, и он все равно не работает.
delegate void SetControlImageIndex(Button oControl, ImageIndexConverter aIndex);
private void SetControlKey(Button oControl, ImageIndexConverter aIndex )
{
// Check if the Invoke is required
if (oControl.InvokeRequired)
{
// Create an instance of the delegate
SetControlImageIndex a = new SetControlImageIndex(SetControlKey);
// Invoke the delegate callback
this.Invoke(a, new object[] { oControl, aIndex });
}
else
{
// Invoke is not required...set the property
oControl.ImageIndex = Convert.ToInt32(aIndex);
}
}