Indezine Logo




Creating a Ribbon in PowerPoint - 2 of 2

Read an exclusive book excerpt from VSTO 3.0 for Office 2007 Programming is presented here with permission from Packt Publishing.


Author:

Product/Version: PowerPoint



Learn PowerPoint

PowerPoint: Sounds from the Clip Art pane do not play!




< Continued from Page 1

  1. Next, select the User Control, and name it UserControl1.cs.
  2. Select the User Control
  3. Open the UserControl1.cs file, and add the following namespace references:
    using System.Windows.Forms;
    using Office = Microsoft.Office.Core;
    using PowerPoint = Microsoft.Office.Interop.PowerPoint;
  4. Open the Ribbon1.cs fi le, and add the following namespace references:
    using System.Windows.Forms;
    using Office = Microsoft.Office.Core;
    using PowerPoint = Microsoft.Office.Interop.PowerPoint;
    
  5. Next, add the instance of the User Control and custom task pane to the Ribbon code file:
    // Usercontrol instance to access from the Ribbon
    private UserControl1 PacktUserControl;
    // Instance for Custom Task Pane to create
    private Microsoft.Office.Tools.CustomTaskPane PacktCustomPane;
    
  6. 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;
    }
    
  7. 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());
    }
    }
    

You May Also Like: How to Use PowerPoint Differently: 3 Unique Use Cases | Flags and Maps - O PowerPoint Templates


Popular Posts

Creating Anchor Points for Connectors in PowerPoint 2010 for Windows
Creating Anchor Points for Connectors in PowerPoint 2010 for Windows
Learn how to create Anchor Points for connectors in PowerPoint 2010.

Working With Slide Numbers in PowerPoint 2016 for Windows
Working With Slide Numbers in PowerPoint 2016 for Windows
Learn how to add Slide Numbers on slides and Masters and more tricks on making them work to your will in PowerPoint 2016 for Windows.

Texture Fills for Slide Backgrounds in PowerPoint 2013 for Windows
Texture Fills for Slide Backgrounds in PowerPoint 2013 for Windows
Use texture fills for slide backgrounds in PowerPoint 2013 for Windows.

Adding More Guides in PowerPoint 2016 for Windows
Adding More Guides in PowerPoint 2016 for Windows
Learn how to add more guides in PowerPoint 2016 for Windows.



Polygon Center Circles for PowerPoint

These special circles have polygon centers: the centers are made of triangles, squares, pentagons, and hexagons! And based on the sides of the polygon, the rest of the circle has that many segments.

Download and use these Polygon Center Circles in your slides for just $4.99

This is the original page. An AMP (Accelerated Mobile Page) version of this page is also available for those on mobile platforms, at Creating a Ribbon in PowerPoint - 2 of 2.


Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.

Home | PowerPoint | Photoshop | PowerPoint Templates | PowerPoint Tutorials | Blog | Notes | Ezine | Advertise | Feedback | Site Map | About Us | Contact Us

Link to Us | Privacy | Testimonials

PowerPoint Backgrounds | Christian PowerPoint Backgrounds | Business PowerPoint Presentation Templates

Plagiarism will be detected by Copyscape

©2000-2021, Geetesh Bajaj. All rights reserved.