共用方式為


DataRepeater.SelectionColorChanged 事件

SelectionColor 屬性變更時發生。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
Public Event SelectionColorChanged As EventHandler
public event EventHandler SelectionColorChanged
public:
 event EventHandler^ SelectionColorChanged {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
member SelectionColorChanged : IEvent<EventHandler,
    EventArgs>
JScript 不支援事件。

備註

使用這個事件來執行程式碼時SelectionColor在執行階段變更的項目標題的屬性。

如需如何處理事件的詳細資訊,請參閱處理和引發事件

範例

下列範例示範如何回應SelectionColorChanged事件。

Private Sub DataRepeater1_SelectionColorChanged(
  ) Handles DataRepeater1.SelectionColorChanged
    Dim ColorString As String = DataRepeater1.SelectionColor.ToString
    Dim BracketPosition As Integer 
    ' Find the left bracket.
    BracketPosition = InStr(ColorString, "[")
    ' Find the color name.
    ColorString = Microsoft.VisualBasic.Right(ColorString, 
     Len(ColorString) - BracketPosition)
    ColorString = Microsoft.VisualBasic.Left(ColorString, 
     Len(ColorString) - 1)
    ' Display a message.
    MsgBox("Selections will be indicated by a " & ColorString &
       " header.")
End Sub
private void dataRepeater1_SelectionColorChanged(object sender, System.EventArgs e)
{
    StringBuilder MyStringBuilder = new StringBuilder(dataRepeater1.SelectionColor.ToString());
    string searchWithinThis = dataRepeater1.SelectionColor.ToString();
    // Find the color name. 
    string searchForThis = "[";
    int firstCharacter = searchWithinThis.IndexOf(searchForThis);
    MyStringBuilder.Remove(0, firstCharacter + 1);
    MyStringBuilder.Replace(']', ' ');

    // Display a message.
    MessageBox.Show("Selections will be indicated by a " + MyStringBuilder + "header.");
}

.NET Framework 安全性

請參閱

參考

DataRepeater 類別

Microsoft.VisualBasic.PowerPacks 命名空間

SelectionColor

其他資源

DataRepeater 控制項簡介 (Visual Studio)