ComponentOne Menus and Toolbars for WinForms
Menus and Toolbars for WinForms Task-Based Help / TopicBar Tasks / Customizing the Appearance / Adding a Background Image
In This Topic
    Adding a Background Image
    In This Topic

    You can add a background image to the C1TopicBar control using the BackgroundImage property. In this topic, you will learn to set this property using the Properties window and code.

    Using the Properties Window

    Complete the following steps:

    1. Navigate to the Toolbox and double-click the C1TopicBar icon to add the C1TopicBar control to your form.
    2. Right-click the C1TopicBar control to open its context menu and then select Properties. The Properties window opens with the C1TopicBar control's properties in focus.
    3. Locate the BackgroundImage property and click its ellipsis button ellipsis icon to open the Select Resource dialog box.
    4. Select the Local resource radio button and then click Import. The Open dialog box opens.
    5. Navigate to the folder holding your background image, select the image, and then click Open to import the image.
    6. The Open dialog box closes, returning you to the Select Resource dialog box.
    7. Click OK to close the Select Resource dialog box.

    Your background image is added to the C1TopicBar control.

    Using Code

    Complete the following steps:

    1. Navigate to the Toolbox and double-click the C1TopicBar icon to add the C1TopicBar control to your form.
    2. Double-click the empty portion of the form to open Code view. Notice that a Form_Load event handler has been added to Code view.
    3. Set the background image by adding the following code (replacing C:\YourImage.jpg with your own path and image name) to the Form_Load event:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      c1TopicBar1.BackgroundImage = System.Drawing.Image.FromFile(“C:\YourImage.jpg”)
      

      To write code in C#

      C#
      Copy Code
      c1TopicBar1.BackgroundImage = System.Drawing.Image.FromFile(@”C:\YourImage.jpg”);
      
    4. Press F5 to build the project.

    This topic illustrates the following:

    In this topic, you learned how to add a background image using the Properties window and code. The following image depicts a C1TopicBar control with a custom background image.


    Topic bar
    See Also