AxacLayersCtrl.BackColor Property

The BackColor property gets or sets the control background color.

 

Syntax

Visual Basic .NET:

Public Property BackColor As System.Drawing.Color

C#:

public System.Drawing.Color BackColor { get; set; }

C++:

public void IacLayersCtrl::PutBackColor(OLE_COLOR pclr)
public void IacLayersCtrl::GetBackColor(OLE_COLOR pclr)

 

Parameters

pclr

Background Color.

 

Return Value

It returns the control background color.

 

Remarks

Member of AxACPDFCREXTLib.AxacLayersCtrl.

 

 

Example

Public Class Form1

    Friend WithEvents AxPDFCreactiveX1 As AxACPDFCREACTIVEX.AxPDFCreactiveX = New AxACPDFCREACTIVEX.AxPDFCreactiveX()

    Friend WithEvents AxacLayersCtrl1 As AxACPDFCREXTLib.AxacLayersCtrl = New AxACPDFCREXTLib.AxacLayersCtrl()

 

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        ' Form1

        Me.Size = New System.Drawing.Size(850, 550)

 

        ' AxPDFCreactiveX1

        AxPDFCreactiveX1.Parent = Me

        AxPDFCreactiveX1.Enabled = True

        AxPDFCreactiveX1.Location = New System.Drawing.Point(30, 60)

        AxPDFCreactiveX1.Name = "AxPDFCreactiveX1"

        AxPDFCreactiveX1.Size = New System.Drawing.Size(470, 440)

        AxPDFCreactiveX1.TabIndex = 0

 

        ' AxacLayersCtrl1

        AxacLayersCtrl1.Parent = Me

        AxacLayersCtrl1.Enabled = True

        AxacLayersCtrl1.Location = New System.Drawing.Point(530, 60)

        AxacLayersCtrl1.Name = "AxacLayersCtrl1"

        AxacLayersCtrl1.Size = New System.Drawing.Size(270, 440)

        AxacLayersCtrl1.TabIndex = 1

 

        ' Configuration

        AxacLayersCtrl1.BackColor = Color.AliceBlue

        AxacLayersCtrl1.FitToParent = 0

 

        ' Initialize Layers Control

        AxacLayersCtrl1.Initialize(AxPDFCreactiveX1.GetOcx())

 

        ' Constants for Activation codes

        Const strLicenseTo As String = "Amyuni PDF Creator Evaluation"

        Const strActivationCode As String = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"

 

        ' Set license key

        AxPDFCreactiveX1.SetLicenseKey(strLicenseTo, strActivationCode)

 

        ' Create all the Layers

        Dim layerID1 As String = ""

        Dim layerID2 As String = ""

        AxPDFCreactiveX1.AddLayer("Layer 1", layerID1)

        AxPDFCreactiveX1.AddLayer("Layer 2", layerID2)

 

        ' Define the layer configuration as it will appear in a PDF Viewer, e.g.the order And visibility of layers

        Dim configID As String = ""

        AxPDFCreactiveX1.AddLayerConfiguration(configID)

 

        ' order of appearance in the tree

        AxPDFCreactiveX1.ObjectAttributeStr("LayerConfigs[" + configID + "]", "ConfigOrder", "[(Main Document)[" + layerID2 + " " + layerID1 + "]]")

 

        ' set one of the layers visibility to off by default

        AxPDFCreactiveX1.ObjectAttributeStr("LayerConfigs[" + configID + "]", "ConfigOFF", "[" + layerID2 + "]")

 

        ' Change the PDF object to Design Mode

        AxPDFCreactiveX1.ReportState = ACPDFCREACTIVEX.ReportStateConstants.acReportStateDesign

 

        ' Create a 5 text object in the same page

        Dim pageCount As Integer = 5

        For i = 1 To pageCount

            ' set current page

            AxPDFCreactiveX1.CurrentPage = i

 

            ' Create a Text in the current Page

            AxPDFCreactiveX1.CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants.acObjectTypeText, "Text" + i.ToString)

            Dim oText As ACPDFCREACTIVEX.IacObject = AxPDFCreactiveX1.GetObjectByName("Text" + i.ToString)

            oText("Left") = 1000

            oText("Right") = 5000

            oText("Top") = 1000 * i

            oText("Bottom") = oText("Top") + 1000

            oText("BorderColor") = &HFF00FF

            oText("BorderWidth") = ACPDFCREACTIVEX.acBorderWidth.acBorderWidthDouble

            oText("Text") = "Amyuni Technologies " + i.ToString

            If i Mod 2 = 0 Then

                oText("LayerID") = layerID1

            Else

                oText("LayerID") = layerID2

            End If

        Next

 

        ' Change the PDF object to Run Mode

        AxPDFCreactiveX1.ReportState = ACPDFCREACTIVEX.ReportStateConstants.acReportStateRun

 

        ' The layer configuration is parsed when the document is loaded.  So for the current

        ' Version, it Is necessary that document has to be saved And reopened when the layers

        ' are being created Or configured programmatically.

 

        ' Save PDF

        AxPDFCreactiveX1.Save("c:\temp\CreatePDFDocument_resulting.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView)

 

        ' Open an existent PDF file

        Dim fileName As String = "c:\temp\CreatePDFDocument_resulting.pdf"

        Dim password As String = ""

        AxPDFCreactiveX1.Open(fileName, password)

 

        ' Check if the control is initialized

        If AxacLayersCtrl1.IsInitialized Then

            MessageBox.Show("Thumbnail Control has been initialized")

        Else

            MessageBox.Show("Thumbnail Control has not been initialized")

        End If

 

        ' Set lock

        AxacLayersCtrl1.Locked = 0

 

        ' Refresh

        AxacLayersCtrl1.Refresh()

    End Sub

End Class

public AxACPDFCREACTIVEX.AxPDFCreactiveX axPDFCreactiveX1 = new AxACPDFCREACTIVEX.AxPDFCreactiveX();

public AxACPDFCREXTLib.AxacLayersCtrl axacLayersCtrl1 = new AxACPDFCREXTLib.AxacLayersCtrl();

 

public Form1()

{

    InitializeComponent();

}

 

private void Form1_Load(object sender, EventArgs e)

{

    // Form1

    this.Size = new System.Drawing.Size(850, 550);

 

    // axPDFCreactiveX1

    axPDFCreactiveX1.Parent = this;

    axPDFCreactiveX1.Enabled = true;

    axPDFCreactiveX1.Location = new System.Drawing.Point(30, 60);

    axPDFCreactiveX1.Name = "axPDFCreactiveX1";

    axPDFCreactiveX1.Size = new System.Drawing.Size(470, 440);

    axPDFCreactiveX1.TabIndex = 0;

 

    // axacLayersCtrl1

    axacLayersCtrl1.Parent = this;

    axacLayersCtrl1.Enabled = true;

    axacLayersCtrl1.Location = new System.Drawing.Point(530, 60);

    axacLayersCtrl1.Name = "axacLayersCtrl1";

    axacLayersCtrl1.Size = new System.Drawing.Size(270, 440);

    axacLayersCtrl1.TabIndex = 1;

    // axacLayersCtrl1.SizeToZero += new System.EventHandler(this.axacBookmarkCtrl_SizeToZero);

 

    // Configuration

    axacLayersCtrl1.BackColor = Color.AliceBlue;

    axacLayersCtrl1.FitToParent = 0;

 

    // Initialize Bookmark

    axacLayersCtrl1.Initialize(axPDFCreactiveX1.GetOcx());

 

    // Configuration

    axacLayersCtrl1.BackColor = Color.AliceBlue;

    axacLayersCtrl1.FitToParent = 0;

 

    // Constants for Activation codes

    const string strLicenseTo = "Amyuni PDF Creator Evaluation";

    const string strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";

 

    // Initializing PDFCreativeX Object

    ACPDFCREACTIVEX.PDFCreactiveX pdf = new ACPDFCREACTIVEX.PDFCreactiveX();

 

    // Set license key

    axPDFCreactiveX1.SetLicenseKey(strLicenseTo, strActivationCode);

 

    // Create all the Layers

    string layerID1 = "";

    string layerID2 = "";

    axPDFCreactiveX1.AddLayer("Layer 1", ref layerID1);

    axPDFCreactiveX1.AddLayer("Layer 2", ref layerID2);

 

    // Define the layer configuration as it will appear in a PDF Viewer, e.g.the order and visibility of layers

    string configID = "";

    axPDFCreactiveX1.AddLayerConfiguration(ref configID);

 

    // order of appearance in the tree

    axPDFCreactiveX1.ObjectAttributeStr("LayerConfigs[" + configID + "]", "ConfigOrder", "[(Main Document)[" + layerID2 + " " + layerID1 + "]]");

 

    // set one of the layers visibility to off by default

    axPDFCreactiveX1.ObjectAttributeStr("LayerConfigs[" + configID + "]", "ConfigOFF", "[" + layerID2 + "]");

 

    // Change the PDF object to Design Mode

    axPDFCreactiveX1.ReportState = ACPDFCREACTIVEX.ReportStateConstants.acReportStateDesign;

 

    // Create a 5 page with a text object and Page BookMark

    int pageCount = 5;

    for (int i = 1; i <= pageCount; i++)

    {

        // Set the current page

        axPDFCreactiveX1.CurrentPage = i;

 

        // Create a Text in the current Page

        axPDFCreactiveX1.CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants.acObjectTypeText, "Text" + i.ToString());

        ACPDFCREACTIVEX.IacObject oText = axPDFCreactiveX1.GetObjectByName("Text" + i.ToString());

        oText["Left"] = 1000;

        oText["Right"] = 5000;

        oText["Top"] = 1000 * i;

        oText["Bottom"] = (int)oText["Top"] + 1000;

        oText["BorderColor"] = 0xFF00FF;

        oText["BorderWidth"] = ACPDFCREACTIVEX.acBorderWidth.acBorderWidthDouble;

        oText["Text"] = "Amyuni Technologies " + i.ToString();

        if (i % 2 == 0)

        {

            oText["LayerID"] = layerID1;

        }

        else

        {

            oText["LayerID"] = layerID2;

        }

    }

 

    // Change the PDF object to Run Mode

    axPDFCreactiveX1.ReportState = ACPDFCREACTIVEX.ReportStateConstants.acReportStateRun;

 

    // The layer configuration is parsed when the document is loaded.  So for the current

    // Version, it Is necessary that document has to be saved And reopened when the layers

    // are being created Or configured programmatically.

 

    // Save PDF

    axPDFCreactiveX1.Save(@"c:\temp\CreatePDFDocument_resulting.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView);

 

    // Open an existent PDF file

    string fileName = @"c:\temp\CreatePDFDocument_resulting.pdf";

    string password = "";

    axPDFCreactiveX1.Open(fileName, password);

 

    // Check if the control is initialized

    if (axacLayersCtrl1.IsInitialized == 1)

    {

        MessageBox.Show("Thumbnail Control has been initialized");

    }

    else

    {

        MessageBox.Show("Thumbnail Control has not been initialized");

    }

 

    // // Set lock

    axacLayersCtrl1.Locked = 0;

 

    // Refresh

    axacLayersCtrl1.Refresh();

}

#import "c:\users\amyuni\pdfcreactivex.dll" no_namespace

#import "c:\users\amyuni\acpdfcrext.dll" no_namespace

 

IPDFCreactiveXPtr m_PDF;

IacLayersCtrlPtr m_LAYER;

 

// TODO: Add extra initialization here

m_PDF = GetDlgItem(IDC_PDFCREACTIVEX1)->GetControlUnknown();

m_LAYER = GetDlgItem(IDC_ACLAYERSCTRL1)->GetControlUnknown();

 

// Configuration

m_LAYER->BackColor = 0xF0F8FF;

m_LAYER->FitToParent = 0;

 

// Initialize Bookmark

m_LAYER->Initialize(m_PDF);

 

// Constants for Activation codes

const bstr_t strLicenseTo = "Amyuni PDF Creator Evaluation";

const bstr_t strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";

 

// Set license key

m_PDF->SetLicenseKey(strLicenseTo, strActivationCode);

 

// Create all the Layers

HRESULT hr;

_bstr_t layerID1;

_bstr_t layerID2;

hr = m_PDF->AddLayer("Layer 1", &layerID1.GetBSTR());

hr = m_PDF->AddLayer("Layer 2", &layerID2.GetBSTR());

 

// Define the layer configuration as it will appear in a PDF Viewer, e.g.the order and visibility of layers

_bstr_t configID = "";

hr = m_PDF->AddLayerConfiguration(&configID.GetBSTR());

 

// order of appearance in the tree

hr = m_PDF->ObjectAttributeStr("LayerConfigs[" + configID + "]", "ConfigOrder", "[(Main Document)[" + layerID2 + " " + layerID1 + "]]");

 

// set one of the layers visibility to off by default

hr = m_PDF->ObjectAttributeStr("LayerConfigs[" + configID + "]", "ConfigOFF", "[" + layerID2 + "]");

 

// Change the PDF object to Design Mode

m_PDF->ReportState = acReportStateDesign;

 

// Create a 5 page with a text object and Page BookMark

int pageCount = 5;

for (int i = 1; i <= pageCount; i++)

{

    // Set the current page

    m_PDF->CurrentPage = i;

 

    // Set-up variables for attributes

    _variant_t varAttribute;

    varAttribute.vt = VT_I4;  // integers

 

    // Create a text in the current Page

    m_PDF->CreateObject(acObjectTypeText, "Text" + bstr_t(i));

    IacObjectPtr oText = m_PDF->GetObjectByName("Text" + bstr_t(i));

    oText->Attribute["Left"] = 1000;

    oText->Attribute["Right"] = 5000;

    oText->Attribute["Top"] = 1000*i;

    oText->Attribute["Bottom"] = (int)(oText->Attribute["Top"]) + 1000;

    varAttribute.lVal = 0xFF00FF;

    oText->Attribute["BorderColor"] = varAttribute;

    varAttribute.lVal = acBorderWidthDouble;

    oText->Attribute["BorderWidth"] = varAttribute;

    oText->Attribute["Text"] = "Amyuni Technologies" + bstr_t(i);

    if (i % 2 == 0)

    {

        oText->Attribute["LayerID"] = layerID1;

    }

    else

    {

        oText->Attribute["LayerID"] = layerID2;

    }

}

 

// Change the PDF object to Run Mode

m_PDF->ReportState = acReportStateRun;

 

// The layer configuration is parsed when the document is loaded.  So for the current

// Version, it Is necessary that document has to be saved And reopened when the layers

// are being created Or configured programmatically.

 

// Save PDF

m_PDF->Save("c:\\temp\\CreatePDFDocument_resulting.pdf", acFileSaveView);

 

// Open an existent PDF file

bstr_t fileName = "c:\\temp\\CreatePDFDocument_resulting.pdf";

bstr_t password = "";

m_PDF->Open(fileName, password);

 

// Check if the control is initialized

if (m_LAYER->IsInitialized == 1)

{

    MessageBox(_T("Thumbnail Control has been initialized"), _T(""), MB_YESNO);

}

else

{

    MessageBox(_T("Thumbnail Control has not been initialized"), _T(""), MB_YESNO);

}

 

// // Set lock

m_LAYER->Locked = 0;

 

// Refresh

m_LAYER->Refresh();