OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Bug set color On Windows 2000

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
lexus56
General User
General User


Joined: 01 Nov 2008
Posts: 20

PostPosted: Thu Aug 27, 2009 6:33 pm    Post subject: Bug set color On Windows 2000 Reply with quote

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#
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group