Scheduler for WinForms | ComponentOne
C1.Win.C1Schedule.4.5.2 Assembly / C1.Win.C1Schedule Namespace / C1Schedule Class / BeforeGroupHeaderFormat Event
Example

In This Topic
    BeforeGroupHeaderFormat Event (C1Schedule)
    In This Topic
    Occurs before the group header is formatted.
    Syntax
    'Declaration
     
    Public Event BeforeGroupHeaderFormat As System.EventHandler(Of BeforeGroupHeaderFormatEventArgs)
    public event System.EventHandler<BeforeGroupHeaderFormatEventArgs> BeforeGroupHeaderFormat
    Event Data

    The event handler receives an argument of type BeforeGroupHeaderFormatEventArgs containing data related to this event. The following BeforeGroupHeaderFormatEventArgs properties provide information specific to this event.

    PropertyDescription
    Gets the ScheduleGroupItem object which is currently formatted.  
    Gets or sets the GroupTabStyle value determining the group header tab appearance.  
    Gets or sets the html text displayed in the group header.  
    Gets or sets the Style object, which will be used for displaying the group header.  
    Gets or sets the System.Boolean value determining the group header tab appearance. If this property value is true, C1Schedule will show MS Outlook 2010-alike group headers. If this property value is false, C1Schedule will display rectangular group headers.  
    Remarks
    Use this event to alter default group header appearance. You can change group header style, tab shape or displayed content.
    Example
    This sample shows how to alter group header appearance depending on BeforeGroupHeaderFormatEventArgs properties.
    private void c1Schedule1_BeforeGroupHeaderFormat(object sender, BeforeGroupHeaderFormatEventArgs e)
    {
        Contact owner = e.Group.Owner as Contact;
        if (owner != null)
        {
            TestSchedule.NwindDataSet.EmployeesRow row = this.nwindDataSet.Employees.FindByEmployeeID((int)owner.Key[0]);
            if (row != null)
            {
                string imageName = "photo" + row.EmployeeID + ".bmp";
                if (File.Exists(imageName))
                {
    					// use image from file
    					// note, C1Schedule only accepts images from internet (http://..), 
    					// application resources (res://..) and local file system (file:///...).
    					e.Html = row.FirstName + " " + row.LastName + "<br><img src=file:///" + imageName + "/>";
                }
            }
        }
        if (e.Style.Hot != null)
        {
            // Hot style is applied to the group header when ScheduleGroupItem is selected.
            e.Style.Hot.BackColor2 = e.Style.Hot.BorderColor = Color.DarkSlateGray;
            e.Style.Hot.ForeColor = Color.WhiteSmoke;
        }
        // use rectangular tab
        e.TriangleTab = false;
    }
    See Also