lexus56 General User

Joined: 01 Nov 2008 Posts: 20
|
Posted: Thu Aug 27, 2009 6:33 pm Post subject: Bug set color On Windows 2000 |
|
|
this function set color successfully on Windows XP,that checking with OpenOffice 2.4
и 3.1, but on Windows 2000 on the same version I get error "Exception has been thrown by the target of an invocation"
on string
Invoke(found, "CharColor", BindingFlags.SetProperty, new Object[1] { cvet });.
| Code: | public override void SetTextColor(System.Drawing.Color Color)
{
if (oComponent == null)
{
return;
}
try
{
if (found == null)
{
arg = new Object[0];
found = Invoke(oText, "CreateTextCursor", BindingFlags.InvokeMethod, arg);
}
long cvet = 0 ;
cvet = RGB(Color.R, Color.G, Color.B);
Invoke(found, "CharColor", BindingFlags.SetProperty, new Object[1] { cvet });
catch (Exception er)
{
MessageBox.Show(er.Message);
}
}
}
private long RGB(int red, int green, int blue)
{
return ((red << 16) | (green << 8) | (blue));
}
protected static object Invoke(object obj, string method, BindingFlags binding, params object[] par)
{
return obj.GetType().InvokeMember(method, binding, null, obj, par);
} |
P.S.
This code write on C# |
|