|Color||A color expression that indicates the color used for painting the selection background. The last 7 bits in the high significant byte of the color to indicates the identifier of the skin being used. Use the Add method to add new skins to the control. If you need to remove the skin appearance from a part of the control you need to reset the last 7 bits in the high significant byte of the color being applied to the background's part.|
Use the SelBackColor and SelForeColor properties to define the colors used for selected items. The control highlights the selected items only if the SelBackColor and BackColor properties have different values, and the SelForeColor and ForeColor properties have different values. Use the SelectCount property to get the number of selected items. Use the SelectedItem property to get the selected item. Use the SelectItem to select or unselect a specified item. Use the FocusItem property to get the focused item. The control fires the SelectionChanged event when user changes the selection. Use the SelectableItem property to specify the user can select an item. Use the ShowFocusRect property to specify whether the control marks the focused item. How do I assign a new look for the selected item?
The following VB sample changes the visual appearance for the selected item. 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 SelBackColor property to indicates the index of the skin that we want to use. The sample applies the "" to the selected item(s):
With List1 With .VisualAppearance .Add &H23, App.Path + "\selected.ebn" End With .SelForeColor = RGB(0, 0, 0) .SelBackColor = &H23000000 End With
The sample adds the skin with the index 35 ( Hexa 23 ), and applies to the selected item using the SelBackColor property.
The following C++ sample applies a new appearance to the selected item(s):
#include "Appearance.h" m_list.GetVisualAppearance().Add( 0x23, COleVariant(_T("D:\\Temp\\ExList_Help\\selected.ebn")) ); m_list.SetSelBackColor( 0x23000000 ); m_list.SetSelForeColor( 0 );
The following VB.NET sample applies a new appearance to the selected item(s):
With AxList1 With .VisualAppearance .Add(&H23, "D:\Temp\ExList_Help\selected.ebn") End With .SelForeColor = Color.Black .Template = "SelBackColor = 587202560" End With
The VB.NET sample uses the Template property to assign a new value to the SelBackColor property. The 587202560 value represents &23000000 in hexadecimal.
The following C# sample applies a new appearance to the selected item(s):
axList1.VisualAppearance.Add(0x23, "D:\\Temp\\ExList_Help\\selected.ebn"); axList1.Template = "SelBackColor = 587202560";
The following VFP sample applies a new appearance to the selected item(s):
With thisform.List1 With .VisualAppearance .Add(35, "D:\Temp\ExList_Help\selected.ebn") EndWith .SelForeColor = RGB(0, 0, 0) .SelBackColor = 587202560 EndWith
The 587202560 value represents &23000000 in hexadecimal. The 32 value represents &23 in hexadecimal
With List1 .VisualAppearance.Add &H34, App.Path + "\aqua.ebn" .SelBackColor = &H34000000 End With
Please notice that the 34 hexa value is arbitrary chosen, it is not a predefined value. Shortly, we have added a skin with the identifier 34, and we specified that the SelBackColor property should use that skin, in order to change the visual appearance for the selected item. Also, please notice that the 34 value is stored in the first significant byte, not in other position. For instance, the following sample doesn't use any skin when displaying the selected item:
With List1 .VisualAppearance.Add &H34, App.Path + "\aqua.ebn" .SelBackColor = &H34 End With
This code ( red code ) DOESN'T use any skin, because the 34 value is not stored in the higher byte of the color value. The sample just changes the background color for the selected item to some black color ( RGB(0,0,34 ) ). So, please pay attention when you want to use a skin and when to use a color. Simple, if you are calling &H34000000, you have 34 followed by 6 ( six ) zeros, and that means the first significant byte of the color expression. Now, back to the problem. The next step is how we are creating skins? or EBN files? The Exontrol's exbutton component includes a builder tool that saves skins to EBN files. So, if you want to create new skin files, you need to download and install the exbutton component from our web site. Once that the exbutton component is installed, please follow the steps.
Let's say that we have a BMP file, that we want to stretch on the selected item's background.
You can always open the skin with the builder and change it later, in case you want to change it.
Now, create a new project, and insert the component where you want to use the skin, and add the skin file to the Appearance collection of the object, using blue code, by changing the name of the file or the path where you have selected the skin. Once that you have added the skin file to the Appearance collection, you can change the visual appearance for parts of the controls that supports skinning. Usually the properties that changes the background color for a part of the control supports skinning as well.