mercredi 15 janvier 2020

Setting a tooltip using Reflection

I need to set the tooltip of a control that is inside a user control. I cannot modify the user control since it is compiled. The reason for changing the tooltip is because of its language.

var wmp_CloseWindowButton = wmp.GetType().GetProperty("CloseWindowButton", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(wmp, null);

var wmp_tooltip = wmp.GetType().GetProperty("ToolTip1", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(wmp, null);

var x = wmp_tooltip.GetMethod("SetToolTip");

This is where I don't know what to do.

x.Invoke ???????

The following always returns null.

var Mypropertyinfo = wmp_tooltip.GetProperty("ToolTip");

Thank you very much in advance Félix





Aucun commentaire:

Enregistrer un commentaire