Monday, October 6, 2014

Cust 36: Export Sheets to PDF: Part 3

...continued from Part 2

With the button still selected on the Form, change its Image property and browse to an image file that you can easily make in MS Paint or by using capturing small areas of the screen using this utility called LightScreen.

Using an image with a white background, the button would appear as below:

09

To make the image's background transparent, a free program called paint.Net can be used.

Once installed, click the Colors icon in the top-right corner of paint.Net or press F8 to display the Colors palette if not already visible.

05

On the Colors palette, click the More>> button

06

07

On the expanded palette, Right-Click on the color in the bottom left corner which looks like chequered gray and white. This is a transparent color or Alpha Channel. By right-clicking this becomes the secondary or background color.

Next, select the 'Magic Wand' tool from the Tools palette and click in the white area of the image. Press Delete on the keyboard. The color is now replaced with the secondary color i.e. transparent color represented by a gray + white tiled pattern.

08

When assigned to the Image property of the PictureBox control, the image appears as below.

04

The button's background color fills the transparent color on the image which then renders seamlessly on the button.

Double-Click the button to enter its Click event.

Just above the Click event but under the Form1 class, add the variables for Inventor and the drawing document:

Public Class Form1
    Dim oApp As Inventor.Application
    Dim oDoc As Inventor.DrawingDocument

   Private Sub btnExportSheets_Click(sender As System.Object, e As System.EventArgs) Handles btnExportSheets.Click

For the Click event of the button, first store the current instance of Inventor in the oApp variable using the GetActiveObject method of the Marshal class. The Marshal class was made available by importing the Runtime.InteropServices namespace of .Net at the top of the code window.

Similarly, oDoc stores the Inventor Drawing Document that you want to export to one of the formats PDF, DXF, etc.

Continued to part 4...


Full Index of Inventor Tutorials, Tips & Crosswords