method Appearance.Add (ID as Long, Skin as Variant)
Adds or replaces a skin object to the control.

 TypeDescription 
   ID as Long A Long expression that indicates the index of the skin being added or replaced. The value must be between 1 and 126, so Appearance collection should holds no more than 126 elements.  
   Skin as Variant A string expression that indicates one of the following:
  • an Windows XP Theme part, it should start with "XP:". For instance the "XP:Header 1 2" indicates the part 1 of the Header class in the state 2, in the current Windows XP theme. In this case the format of the Skin parameter should be: "XP: Control/ClassName Part State" where the ClassName defines the window/control class name in the Windows XP Theme, the Part indicates a long expression that defines the part, and the State indicates the state like listed at the end of the document. This option is available only on Windows XP that supports Themes API.
  • copy of another skin with different coordinates, if it begins with "CP:" . For instance, you may need to display a specified skin on a smaller rectangle. In this case, the string starts with "CP:", and contains the following "CP:n l t r b", where the n is the identifier being copied, the l, t, r, and b indicate the left, top, right and bottom coordinates being used to adjust the rectangle where the skin is displayed. For instance, the "CP:1 4 0 -4 0", indicates that the skin is displayed on a smaller rectangle like follows. 
  • the path to the skin file ( *.ebn ). The Exontrol's exButton component installs a skin builder that should be used to create new skins
  • the BASE64 encoded string that holds a skin file ( *.ebn ). Use the Exontrol's exImages tool to build BASE 64 encoded strings on the skin file (*.ebn) you have created. Loading the skin from a file ( eventually uncompressed file ) is always faster then loading from a BASE64 encoded string

A byte[] or safe arrays of VT_I1 or VT_UI1 expression that indicates the content of the EBN file. You can use this option when using the EBN file directly in the resources of the project. For instance, the VB6 provides the LoadResData to get the safe array o bytes for specified resource, while in VB/NET or C# the internal class Resources provides definitions for all files being inserted. ( ResourceManager.GetObject("ebn", resourceCulture) ).

 
 ReturnDescription 
  BooleanA Boolean expression that indicates whether the new skin was added or replaced. 
Use the Add method to add or replace skins to the control. The skin method, in it's simplest form, uses a single graphic file (*.ebn) assigned to a part of the control. By using a collection of objects laid over the graphic, it is possible to define which sections of the graphic will be used as borders, corners and other possible elements, fixing them to their proper position regardless of the size of the part. Use the Remove method to remove a specific skin from the control. Use the Clear method to remove all skins in the control. Use the BeginUpdate and EndUpdate methods to maintain performance while init the control.

The skin method may change the visual appearance for the following parts in the control:

The identifier you choose for the skin is very important to be used in the background properties like explained bellow. Shortly, the color properties uses 4 bytes ( DWORD, double WORD, and so on ) to hold a RGB value. More than that, the first byte ( most significant byte in the color ) is used only to specify system color. if the first bit in the byte is 1, the rest of bits indicates the index of the system color being used. So, we use the last 7 bits in the high significant byte of the color to indicates the identifier of the skin being used. So, since the 7 bits can cover 127 values, excluding 0, we have 126 possibilities to store an identifier in that byte. This way, a DWORD expression indicates the background color stored in RRGGBB format and the index of the skin ( ID parameter ) in the last 7 bits in the high significant byte of the color. For instance, the BackColor = BackColor Or &H2000000 indicates that we apply the skin with the index 2 using the old color, to the object that BackColor is applied.

For instance, the following VB sample changes the visual appearance for the selected node. The SelColor property indicates the selection background color. Shortly, we need to add a skin to the Appearance object using the Add method, and we need to set the last 7 bits in the SelColor property to indicate the index of the skin that we want to use. The sample applies the "" to the selected node(s):

With ChartView1
    .VisualAppearance.Add 1, "D:\Temp\ExOrgChart.Help\select.ebn"
    .SelColor = &H1000000
End With

The following C++ sample changes the visual appearance for the selected node:

#include "Appearance.h"
m_chartview.GetVisualAppearance().Add( 1, COleVariant("D:\\Temp\\ExOrgChart.Help\\select.ebn") );
m_chartview.SetSelColor( 0x1000000 );

The following VB.NET sample changes the visual appearance for the selected node:

With AxChartView1
    .VisualAppearance.Add(1, "D:\Temp\ExOrgChart.Help\select.ebn")
    .Template = "SelColor = 16777216"
End With

The following C# sample changes the visual appearance for the selected node:

axChartView1.VisualAppearance.Add(1, "D:\\Temp\\ExOrgChart.Help\\select.ebn");
axChartView1.Template = "SelColor = 16777216";

The following VFP sample changes the visual appearance for the selected node:

With thisform.ChartView1
    .VisualAppearance.Add(1, "D:\Temp\ExOrgChart.Help\select.ebn")
    .SelColor = 16777216
EndWith

The screen shot was generated using the following template:

 

 


Send comments on this topic.
1999-2016 Exontrol.COM, Software. All rights reserved.