'宣言 Public Sub SetDataBinding( _ ByVal dataSource As Object, _ ByVal dataMember As String _ )
public void SetDataBinding( object dataSource, string dataMember )
Imports Infragistics.Win Imports Infragistics.Win.UltraWinTabs Imports Infragistics.Win.UltraWinTabControl Private Sub InitializeTabStripControl() With Me.ultraTabStripControl1 ' Set the image background to conform and align with the ' form's BackgroundImage .TabHeaderAreaAppearance.ImageBackground = Me.BackgroundImage .TabHeaderAreaAppearance.ImageBackgroundOrigin = ImageBackgroundOrigin.Form ' Enable hot tracking (tabs hightlight as the mouse passes over them) .HotTrack = True ' Set the layout style of the tabs to a multi-row style .TabLayoutStyle = TabLayoutStyle.MultiRowTabsPerRow ' Set the MultiRowSelectionStyle to highlight the selected tab .MultiRowSelectionStyle = MultiRowSelectionStyle.HighlightTab ' Set the # of tabs per row .TabsPerRow = 4 ' Set the max # of visible rows to show .MaxVisibleTabRows = 5 ' Set the spacing between tabs of the same row and between ' tab rows .InterTabSpacing = New DefaultableInteger(3) .InterRowSpacing = New DefaultableInteger(5) ' Note: the following code sets the spacing back to there ' default values '.InterTabSpacing = DefaultableInteger.Default '.InterRowSpacing = DefaultableInteger.Default ' Set the margins around the tab page. .TabPageMargins.Top = 2 .TabPageMargins.Left = 2 .TabPageMargins.Right = 2 .TabPageMargins.Bottom = 2 ' Set the TabKeyMember. This will automatically initialize ' each tab's Key property to the data value in that column. .TabKeyMember = "CustomerID" ' Set the TabTextMember. This will automatically initialize ' each tab's Text property to the data value in that column. .TabTextMember = "CustomerName" ' Set the ToolTipTextMember. This will automatically initialize ' each tab's ToolTipText property to the data value in that column. .ToolTipTextMember = "Address" ' Set the SortMember. This will automatically sort the tabs ' based on the data values in that column. .SortMember = "CustomerName" ' Set the direction of the sort. .SortDirection = SortDirection.Descending ' Create an in-memory data source Me.CreateData() ' Bind the tab strip to the data source ' Note: This clears the Tabs collection and re-populates it ' with a tab for every row in the data source. .SetDataBinding(Me.dataSource, "") ' Note: Calling SetDataBinding is the same as setting the ' DataSource and DataMember properties individually ' but it does it in one atomic operation. '.DataSource = Me.dataSource '.DataMember = ' End With ' Set the data bindings for some textboxes 'Me.txtCustomerID.DataBindings.Add("Text", Me.dataSource, "CustomerID") 'Me.txtCustomerName.DataBindings.Add("Text", Me.dataSource, "CustomerName") End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabControl; private void InitializeTabStripControl() { // Set the image background to conform and align with the // form's BackgroundImage this.ultraTabStripControl1.TabHeaderAreaAppearance.ImageBackground = this.BackgroundImage; this.ultraTabStripControl1.TabHeaderAreaAppearance.ImageBackgroundOrigin = ImageBackgroundOrigin.Form; // Enable hot tracking (tabs hightlight as the mouse passes over them) this.ultraTabStripControl1.HotTrack = true; // Set the layout style of the tabs to a multi-row style this.ultraTabStripControl1.TabLayoutStyle = TabLayoutStyle.MultiRowTabsPerRow; // Set the MultiRowSelectionStyle to highlight the selected tab this.ultraTabStripControl1.MultiRowSelectionStyle = MultiRowSelectionStyle.HighlightTab; // Set the # of tabs per row this.ultraTabStripControl1.TabsPerRow = 4; // Set the max # of visible rows to show this.ultraTabStripControl1.MaxVisibleTabRows = 4; // Set the spacing between tabs of the same row and between // tab rows this.ultraTabStripControl1.InterTabSpacing = 3; this.ultraTabStripControl1.InterRowSpacing = 5; // Note: The following code does the same //this.ultraTabStripControl1.InterTabSpacing = new DefaultableInteger( 3 ); //this.ultraTabStripControl1.InterRowSpacing = new DefaultableInteger( 5 ); // Note: the following code sets the spacing back to there // default values //this.ultraTabStripControl1.InterTabSpacing = DefaultableInteger.Default; //this.ultraTabStripControl1.InterRowSpacing = DefaultableInteger.Default; // Set the margins around the tab page. this.ultraTabStripControl1.TabPageMargins.Top = 2; this.ultraTabStripControl1.TabPageMargins.Left = 2; this.ultraTabStripControl1.TabPageMargins.Right = 2; this.ultraTabStripControl1.TabPageMargins.Bottom = 2; // Set the TabKeyMember. This will automatically initialize // each tab's Key property to the data value in that column. this.ultraTabStripControl1.TabKeyMember = "CustomerID"; // Set the TabTextMember. This will automatically initialize // each tab's Text property to the data value in that column. this.ultraTabStripControl1.TabTextMember = "CustomerName"; // Set the ToolTipTextMember. This will automatically initialize // each tab's ToolTipText property to the data value in that column. this.ultraTabStripControl1.ToolTipTextMember = "Address"; // Set the SortMember. This will automatically sort the tabs // based on the data values in that column. this.ultraTabStripControl1.SortMember = "CustomerName"; // Set the direction of the sort. this.ultraTabStripControl1.SortDirection = SortDirection.Descending; // Create an in-memory data source this.CreateData(); // Bind the tab strip to the data source // Note: This clears the Tabs collection and re-populates it // with a tab for every row in the data source. this.ultraTabStripControl1.SetDataBinding( this.dataSource, "" ); // Note: Calling SetDataBinding is the same as setting the // DataSource and DataMember properties individually // but it does it in one atomic operation. //this.ultraTabStripControl1.DataSource = this.dataSource; //this.ultraTabStripControl1.DataMember = ""; // Set the data bindings for some textboxes //this.txtCustomerID.DataBindings.Add("Text", this.dataSource, "CustomerID"); //this.txtCustomerName.DataBindings.Add("Text", this.dataSource, "CustomerName"); }