private void HandleSimpleUIntControlEvent(object sender, SUICEventArgs e) { Control UIntControl = sender as Control; TableLayoutPanelCellPosition pos = TableLayoutPanel.GetCellPosition(UIntControl); if (EventHandler != null) { switch (e.Message) { case SUICMessage.Return: EventHandler(this, new UITableEventArgs(UITableMessage.Return)); break; case SUICMessage.ValueChanged: EventHandler(this, new UITableEventArgs(UITableMessage.ValueChanged)); break; case SUICMessage.Left: if (pos.Column > 0 ) pos.Column--; else if (pos.Column == 0 && pos.Row > 0) { pos.Column = TableLayoutPanel.ColumnCount - 1; pos.Row--; } TableLayoutPanel.GetControlFromPosition(pos.Column, pos.Row).Select(); break; case SUICMessage.Right: if (pos.Column < TableLayoutPanel.ColumnCount - 1) pos.Column++; else if(pos.Column == TableLayoutPanel.ColumnCount - 1 && pos.Row < TableLayoutPanel.RowCount - 1) { pos.Column = 0; pos.Row++; } TableLayoutPanel.GetControlFromPosition(pos.Column, pos.Row).Select(); break; case SUICMessage.Up: if (pos.Row > 0) pos.Row--; TableLayoutPanel.GetControlFromPosition(pos.Column, pos.Row).Select(); break; case SUICMessage.Down: if (pos.Row < TableLayoutPanel.RowCount - 1) pos.Row++; TableLayoutPanel.GetControlFromPosition(pos.Column, pos.Row).Select(); break; case SUICMessage.Pos1: TableLayoutPanel.GetControlFromPosition(0, 0).Select(); break; } } }
private void HandleSimpleUIntControlEvent(object sender, SUICEventArgs e) { Control UIntControl = sender as Control; TableLayoutPanelCellPosition pos = TableLayoutPanel.GetCellPosition(UIntControl); if (EventHandler != null) { switch (e.Message) { case SUICMessage.Return: EventHandler(this, new UITableEventArgs(UITableMessage.Return)); break; case SUICMessage.ValueChanged: EventHandler(this, new UITableEventArgs(UITableMessage.ValueChanged)); break; case SUICMessage.Left: if (pos.Column > 0) { pos.Column--; } else if (pos.Column == 0 && pos.Row > 0) { pos.Column = TableLayoutPanel.ColumnCount - 1; pos.Row--; } TableLayoutPanel.GetControlFromPosition(pos.Column, pos.Row).Select(); break; case SUICMessage.Right: if (pos.Column < TableLayoutPanel.ColumnCount - 1) { pos.Column++; } else if (pos.Column == TableLayoutPanel.ColumnCount - 1 && pos.Row < TableLayoutPanel.RowCount - 1) { pos.Column = 0; pos.Row++; } TableLayoutPanel.GetControlFromPosition(pos.Column, pos.Row).Select(); break; case SUICMessage.Up: if (pos.Row > 0) { pos.Row--; } TableLayoutPanel.GetControlFromPosition(pos.Column, pos.Row).Select(); break; case SUICMessage.Down: if (pos.Row < TableLayoutPanel.RowCount - 1) { pos.Row++; } TableLayoutPanel.GetControlFromPosition(pos.Column, pos.Row).Select(); break; case SUICMessage.Pos1: TableLayoutPanel.GetControlFromPosition(0, 0).Select(); break; } } }