'宣言 Public Property ShowOwnerHeader As Infragistics.Win.DefaultableBoolean
public Infragistics.Win.DefaultableBoolean ShowOwnerHeader {get; set;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Add some owners to the UltraCalendarInfo's Owners collection Me.UltraCalendarInfo1.Owners.Add("stan", "Stan Marsh") Me.UltraCalendarInfo1.Owners.Add("kyle", "Kyle Broflovski") Me.UltraCalendarInfo1.Owners.Add("cartman", "Eric Cartman") Me.UltraCalendarInfo1.Owners.Add("kenny", "Kenny McCormick") ' Hide the 'unassigned owner', so that only the owners we added ' to the collection are displayed by any attached controls Me.UltraCalendarInfo1.Owners.UnassignedOwner.Visible = False ' Associate the UltraDayView control with the UltraCalendarInfo ' that we just added the owners to Me.UltraDayView1.CalendarInfo = Me.UltraCalendarInfo1 ' Set the 'GroupingStyle' property to 'DateWithinOwner' ' so that the owner's header is displayed above the day headers Me.UltraDayView1.GroupingStyle = DayViewGroupingStyle.DateWithinOwner ' Set the 'ColumnScrolling' property to 'GroupScrollButtonsOnly' ' so the end user can navigate between owners without the ' need for a scrollbar Me.UltraDayView1.ColumnScrolling = DayViewColumnScrolling.GroupScrollButtonsOnly ' Set the 'AllowColumnResizing' property to true so that the ' end user can resize columns Me.UltraDayView1.AllowColumnResizing = DefaultableBoolean.True ' Set the 'MinimumColumnWidth' property to 150 to prevent the columns ' from becoming too narrow when the user resizes them Me.UltraDayView1.MinimumColumnWidth = 150 ' Set the 'MaximumVisibleDays' property to 1 so that only one ' day is displayed at a time, regardless of the number of days ' that are selected. Me.UltraDayView1.MaximumVisibleDays = 1 ' Set the 'PreferredColumnWidth' property to 150 so the columns ' start off with that initial width Me.UltraDayView1.PreferredColumnWidth = 150 ' Set the 'ShowOwnerHeader' property to true so that the ' owners' headers are displayed Me.UltraDayView1.ShowOwnerHeader = DefaultableBoolean.True ' Use the 'EnsureColumnInView' method to bring a particular owner ' column into view. We'll specify true for the 'forceFirst' parameter ' so that the owner is displayed in the leftmost column. ' ' Also, we'll use the 'IsColumnInView' method to determine whether the ' column is already in view before proceeding. Dim cartman As Infragistics.Win.UltraWinSchedule.Owner cartman = Me.UltraCalendarInfo1.Owners("cartman") If Me.UltraDayView1.IsColumnInView(DateTime.Today, cartman) = False Then Me.UltraDayView1.EnsureColumnInView(DateTime.Today, cartman, True) End If ' Get the first column displayed by the control via the 'InViewColumns' ' collection. We'll use the 'InViewColumnCount' property to verify that ' we have at least one column in view. If Me.UltraDayView1.InViewColumnCount >= 1 Then ' Get a reference to the InViewColumn Dim column As InViewColumn = Me.UltraDayView1.InViewColumns(0) ' Display some information about the InViewColumn in the debugger's output window Debug.WriteLine("The first in-view column's index is " + column.Index.ToString()) Debug.WriteLine("The first in-view column's logical index is " + column.LogicalIndex.ToString()) Debug.WriteLine("The first in-view column's date is " + column.Date.ToShortDateString()) Debug.WriteLine("The first in-view column's owner is '" + column.Owner.Name + "'") End If End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; private void Button1_Click(object sender, System.EventArgs e) { // Add some owners to the UltraCalendarInfo's Owners collection this.ultraCalendarInfo1.Owners.Add( "stan", "Stan Marsh" ); this.ultraCalendarInfo1.Owners.Add( "kyle", "Kyle Broflovski" ); this.ultraCalendarInfo1.Owners.Add( "cartman", "Eric Cartman" ); this.ultraCalendarInfo1.Owners.Add( "kenny", "Kenny McCormick" ); // Hide the 'unassigned owner', so that only the owners we added // to the collection are displayed by any attached controls this.ultraCalendarInfo1.Owners.UnassignedOwner.Visible = false; // Associate the UltraDayView control with the UltraCalendarInfo // that we just added the owners to this.ultraDayView1.CalendarInfo = this.ultraCalendarInfo1; // Set the 'GroupingStyle' property to 'DateWithinOwner' // so that the owner's header is displayed above the day headers this.ultraDayView1.GroupingStyle = DayViewGroupingStyle.DateWithinOwner; // Set the 'ColumnScrolling' property to 'GroupScrollButtonsOnly' // so the end user can navigate between owners without the // need for a scrollbar this.ultraDayView1.ColumnScrolling = DayViewColumnScrolling.GroupScrollButtonsOnly; // Set the 'AllowColumnResizing' property to true so that the // end user can resize columns this.ultraDayView1.AllowColumnResizing = DefaultableBoolean.True; // Set the 'MinimumColumnWidth' property to 150 to prevent the columns // from becoming too narrow when the user resizes them this.ultraDayView1.MinimumColumnWidth = 150; // Set the 'MaximumVisibleDays' property to 1 so that only one // day is displayed at a time, regardless of the number of days // that are selected. this.ultraDayView1.MaximumVisibleDays = 1; // Set the 'PreferredColumnWidth' property to 150 so the columns // start off with that initial width this.ultraDayView1.PreferredColumnWidth = 150; // Set the 'ShowOwnerHeader' property to true so that the // owners' headers are displayed this.ultraDayView1.ShowOwnerHeader = DefaultableBoolean.True; // Use the 'EnsureColumnInView' method to bring a particular owner // column into view. We'll specify true for the 'forceFirst' parameter // so that the owner is displayed in the leftmost column. // // Also, we'll use the 'IsColumnInView' method to determine whether the // column is already in view before proceeding. Infragistics.Win.UltraWinSchedule.Owner cartman = this.ultraCalendarInfo1.Owners[ "cartman" ]; if ( this.ultraDayView1.IsColumnInView(DateTime.Today, cartman) == false ) this.ultraDayView1.EnsureColumnInView( DateTime.Today, cartman, true ); // Get the first column displayed by the control via the 'InViewColumns' // collection. We'll use the 'InViewColumnCount' property to verify that // we have at least one column in view. if ( this.ultraDayView1.InViewColumnCount >= 1 ) { // Get a reference to the InViewColumn InViewColumn column = this.ultraDayView1.InViewColumns[0]; // Display some information about the InViewColumn in the debugger's output window Debug.WriteLine( "The first in-view column's index is " + column.Index.ToString() ); Debug.WriteLine( "The first in-view column's logical index is " + column.LogicalIndex.ToString() ); Debug.WriteLine( "The first in-view column's date is " + column.Date.ToShortDateString() ); Debug.WriteLine( "The first in-view column's owner is '" + column.Owner.Name + "'" ); } }