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)