GridControl分页
参考:https://blog.youkuaiyun.com/sinat_27305053/article/details/80014441?utm_source=distribute.pc_relevant.none-task
- GridControl的UseEmbeddedNavigator属性值设为True
- EmbeddedNavigator属性\Buttons选择需要的按钮
gridView.GridControl.UseEmbeddedNavigator = true;
gridView.GridControl.EmbeddedNavigator.Buttons.Append.Visible = false;
gridView.GridControl.EmbeddedNavigator.Buttons.Edit.Visible = false;
gridView.GridControl.EmbeddedNavigator.Buttons.EndEdit.Visible = false;
gridView.GridControl.EmbeddedNavigator.Buttons.CancelEdit.Visible = false;
gridView.GridControl.EmbeddedNavigator.Buttons.Remove.Visible = false;
- EmbeddedNavigator属性\Buttons\TextStringFormat默认有两个参数,{0}{1} 分别对应当前选中行index,当前页行数。
gridView.GridControl.EmbeddedNavigator.TextStringFormat = "{0}in{1}";
- 事件:
gridView.GridControl.EmbeddedNavigator.ButtonClick += gridControl_EmbeddedNavigator_ButtonClick;
private void gridControl_EmbeddedNavigator_ButtonClick(object sender, NavigatorButtonClickEventArgs e)
{
if (e.Button.ButtonType == NavigatorButtonType.Remove)
{
if (MessageBox.Show("Do you want to delete the current row?", "confirm deletion",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) != DialogResult.Yes)
{
e.Handled = true;
}
}
}