event AddGroup (Group as Group)
Occurs when a new group is added to collection.

 TypeDescription 
   Group as Group A Group object that's added to Groups collection.  

Use the AddGroup event to notify your application that a new group is added to Groups collection. The Add method adds a new group to Groups collection. Use the AddItem method to add new items to the group. Use the ItemHeight property to specify the height for all items in the group. Use the GroupHeight property to specify the height for group captions. Use the SmallIcons property to specify the size of the icons being displayed.

The following VB sample changes the group's background color when adding a new group:

Private Sub ExplorerBar1_AddGroup(ByVal Group As EXPLORERBARLibCtl.IGroup)
    With Group
        .BackColor = RGB(0, 0, 255)
        .Alignment = exRight
        .ForeColor = vbWhite
    End With
End Sub

The following C++ sample changes the group's background color when adding a new group:

void OnAddGroupExplorerbar1(LPDISPATCH Group) 
{
	CGroup group( Group ); group.m_bAutoRelease = FALSE;
	group.SetBackColor( RGB(0,0,255) );
	group.SetAlignment( 2 /*exRight*/ );
	group.SetForeColor( RGB(255,255,255) );
}

The following VB.NET sample changes the group's background color when adding a new group:

Private Sub AxExplorerBar1_AddGroup(ByVal sender As System.Object, ByVal e As AxEXPLORERBARLib._IExplorerBarEvents_AddGroupEvent) Handles AxExplorerBar1.AddGroup
    With e.group
        .BackColor = ToUInt32(Color.Blue)
        .ForeColor = ToUInt32(Color.White)
        .Alignment = EXPLORERBARLib.AlignmentEnum.exRight
    End With
End Sub

where the ToUInt32 function converts a Color expression to OLE_COLOR expression, 

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 group's background color when adding a new group:

private void axExplorerBar1_AddGroup(object sender, AxEXPLORERBARLib._IExplorerBarEvents_AddGroupEvent e)
{
	e.group.BackColor = ToUInt32(Color.Blue);
	e.group.ForeColor = ToUInt32(Color.White);
	e.group.Alignment = EXPLORERBARLib.AlignmentEnum.exRight;
}

where the ToUInt32 function converts a Color expression to OLE_COLOR expression, 

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 group's background color when adding a new group:

*** ActiveX Control Event ***
LPARAMETERS group

with group
	.BackColor = RGB(0,0,255)
	.ForeColor = RGB(255,255,255)
	.Alignment = 2 && exRight
endwith

 


Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.