Rich text box in an Office 2007+ ribbon control
I want to have a rich edit control on an Office 2007+ ribbon control from within an Office add开发者_如何学Python-in. There is no rich text box in a VS2010 designer Toolbox.
Is there a way to put a custom control in a ribbon or is there any other less straightforward way to accomplish this?
You could use a custom task pane instead. Create a UserControl in your add-in project and put the rich text box on it with any other controls you want. Then add your user control to the custom task pane collection. Something like this:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
var mytaskPane = new MyTaskPane();
var myCustomTaskPaneCollection = Globals.Factory.CreateCustomTaskPaneCollection (null, null, "CustomTaskPanes", "CustomTaskPanes", this);
var myCustomTaskPane = _myCustomTaskPaneCollection.Add(mytaskPane , "My Task Pane");
myCustomTaskPane.Visible = true;
}
精彩评论