Change menu font


Author
Message
Jan Dijkstra
Jan Dijkstra
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)
Group: Forum Members
Posts: 3, Visits: 1

I have the following code:

public void SetMenuEnabled(bool isEnabled)
{
   foreach (NCommandContext context in (myCommandManager.Contexts))
   {
       if(context.Properties.Text == "test")
       {
           context.Properties.Selectable = isEnabled;
           context.Properties.Font = new Font(context.Properties.Font.Name, context.Properties.Font.Size, FontStyle.Bold);
       }
   }
}

myCommandManager is an NCommandBarsManager.
When I run this code I get an NullReferenceEception. And when I hover with the mouse, it says that .Font = null.
The setting of the Selectable property works all fine when I comment the .Font line...

How can I set the .Font property?

 


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search