property Item.BackColor as Color
Specifies the item's background color when the UseBackColor property is True.

 TypeDescription 
   Color A color expression that indicates the menu item's color, while UseBackColor property is True. 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 BackColor and ForeColor properties to customize the colors for an menu item. If the UseBackColor property is False, the BackColor property has no effect. The BackColor property is applied to the menu item only if the UseBackColor property is True. Use the <bgcolor> HTML tag in the Caption property to specify the background color for parts of the caption. Changing the BackColor property automatically sets the UseBackColor property on True. Use the PopupBackColor property to change the background color for the popup menu. 

The following VB sample changes the background color for the item with the identifier 50:

With ExMenu1.Item(50)
    .BackColor = vbRed
End With

The following C++ sample changes the background color for the item with the identifier 50:

CItem item = m_menu.GetItem( COleVariant( long( 50 ) ) );
item.SetBackColor( RGB(255,0,0) );

The following VB.NET sample changes the background color for the item with the identifier 50:

With AxExMenu1.item(50)
    .BackColor = ToUInt32(Color.Red)
End With

where the ToUInt32 function converts a Color expression to OLE_COLOR:

Shared Function ToUInt32(ByVal c As Color) As UInt32
    Dim i As Long
    i = c.R
    i = i + 256 * c.G
    i = i + 256 * 256 * c.B
    ToUInt32 = Convert.ToUInt32(i)
End Function

The following C# sample changes the background color for the item with the identifier 50:

EXMENULib.item item = axExMenu1[50];
item.BackColor = ToUInt32(Color.Red);

where the ToUInt32 function converts a Color expression to OLE_COLOR:

private UInt32 ToUInt32(Color c)
{
	long i;
	i = c.R;
	i = i + 256 * c.G;
	i = i + 256 * 256 * c.B;
	return Convert.ToUInt32(i);
}

The following VFP sample changes the background color for the item with the identifier 50:

With thisform.ExMenu1.Item(50)
	.BackColor = RGB(255,0,0)
EndWith
 


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