Microsoft Office Tutorials and References
In Depth Information
Creating a Ribbon
10. Next, write the following code to show the custom task pane in the button
click event of the Ribbon menu:
private void RibbonButton1_Click(object sender,
RibbonControlEventArgs e)
{
// Initializing the UserControl in the ribbon
PacktUserControl = new UserControl1();
// Add the UserControl to the custom task pane
PacktCustomPane = Globals.ThisAddIn.CustomTaskPanes.
Add(PacktUserControl, "Calendar");
// Set the custom task pane to visible
PacktCustomPane.Visible = true;
}
11. On the ValueChanged event of the dateTimePicker , we are writing the code
to insert the selected date.
private void dateTimePicker1_ValueChanged(object sender,
EventArgs e)
{
try
{
// Getting the active presentation slide
PowerPoint.Slide PckTSlide = Globals.ThisAddIn.
Application.ActivePresentation.Slides[1];
// Set the presentation type like text or image imsert option
PacktTextShape = PckTSlide.Shapes.AddTextbox(Office.
MsoTextOrientation.msoTextOrientationHorizontal,
50, 100, 600, 50);
// Set the text value as selected date time
PacktTextShape.TextFrame.TextRange.Text = dateTimePicker1.
Value.ToString();
// Font style properties
PacktTextShape.TextFrame.TextRange.Font.Size = 48;
PacktTextShape.TextFrame.TextRange.Font.Color.RGB = Color.
DarkViolet.ToArgb();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
 
Search JabSto ::




Custom Search