/// <summary> /// This routine shows a simple example of processing /// the MouseClick in the style defined header image. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SuperGridControl1ColumnHeaderClick( object sender, GridColumnHeaderClickEventArgs e) { GridColumnHeader header = e.GridPanel.ColumnHeader; Rectangle r = header.GetImageBounds(e.GridColumn); Point pt = MousePosition; pt = e.GridColumn.SuperGrid.PointToClient(pt); // If the user clicked in the header image, then instead // of sorting the column, let's redefine every cell in the // column to contain a visible state pattern. if (r.Contains(pt) == true) { int k = (int)header.Tag; header.Tag = ++k; for (int i = 0; i < e.GridPanel.Rows.Count; i++) { GridRow row = e.GridPanel.Rows[i] as GridRow; if (row != null) { int n = (k + i) % 8; if ((k + i) % 16 >= 8) { n = 8 - n; } row.Cells[3].Value = "0,1,2,3,4,3,2,1,0".Substring(n << 1); } } e.Cancel = true; } }
/// <summary> /// Gives column 3 (Process State) some extra feedback /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SuperGridControl1MouseMove(object sender, MouseEventArgs e) { SuperGridControl sg = sender as SuperGridControl; if (sg != null) { GridColumnHeader header = sg.GetElementAt(e.Location) as GridColumnHeader; if (header != null) { Point pt = header.SuperGrid.PointToClient(MousePosition); GridColumn column = header.GetHitColumn(pt); if (column != null && column.ColumnIndex == 3) { Rectangle r = header.GetImageBounds(column); if (r.Contains(pt) == true) { if (column.HeaderStyles.MouseOver.ImageIndex < 0) { column.HeaderStyles.MouseOver.ImageIndex = 7; } } else { if (column.HeaderStyles.MouseOver.ImageIndex >= 0) { column.HeaderStyles.MouseOver.ImageIndex = -1; } } } } } }