本文整理汇总了C#中GridControl.EndInit方法的典型用法代码示例。如果您正苦于以下问题:C# GridControl.EndInit方法的具体用法?C# GridControl.EndInit怎么用?C# GridControl.EndInit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridControl
的用法示例。
在下文中一共展示了GridControl.EndInit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddCustomButton
/// <summary>
/// 在表格导航按钮内增加一个自定义按钮
/// </summary>
/// <param name="grid">表格控件</param>
/// <param name="buttonID">按钮编号</param>
/// <param name="buttonImage">按钮图片</param>
/// <param name="buttonHint">按钮提示消息</param>
public static void AddCustomButton(GridControl grid, int buttonID, Image buttonImage, string buttonHint)
{
grid.BeginInit();
ImageList list = grid.EmbeddedNavigator.Buttons.ImageList as ImageList;
list.Images.Add(buttonImage);
NavigatorCustomButton btn = new NavigatorCustomButton(buttonID, buttonHint);
grid.EmbeddedNavigator.Buttons.CustomButtons.AddRange(new NavigatorCustomButton[] { btn });
grid.EndInit();
}
示例2: SetGridControlLayout
/// <summary>
/// 设置表格控件的布局. 比如按钮设置.
/// </summary>
public static void SetGridControlLayout(GridControl grid, bool allowEdit)
{
ControlNavigatorButtons btns = grid.EmbeddedNavigator.Buttons;
grid.BeginInit();
grid.EmbeddedNavigator.ButtonStyle = BorderStyles.Office2003;
grid.UseEmbeddedNavigator = true;
btns.Append.Visible = false;
btns.CancelEdit.Visible = false;
btns.Edit.Visible = false;
btns.Remove.Visible = false;
btns.EndEdit.Visible = false;
btns.NextPage.Visible = false;
btns.PrevPage.Visible = false;
((GridView)grid.Views[0]).OptionsBehavior.Editable = allowEdit; //允许编辑状态
if (allowEdit)//增加两个自定义按钮(ADD,INSERT,DELETE)
{
ImageList img = new ImageList();
img.Images.Add(Globals.LoadImage("16_Add.ico"));
img.Images.Add(Globals.LoadImage("16_Insert.ico"));
img.Images.Add(Globals.LoadImage("16_Delete.ico"));
grid.EmbeddedNavigator.Buttons.ImageList = img;
btns.CustomButtons.Clear();
NavigatorCustomButton btnDtlAdd = new NavigatorCustomButton((int)DetailButtons.Add, "新增记录");
NavigatorCustomButton btnDtlInsert = new NavigatorCustomButton((int)DetailButtons.Insert, "插入记录");
NavigatorCustomButton btnDtlDelete = new NavigatorCustomButton((int)DetailButtons.Delete, "删除记录");
btns.CustomButtons.AddRange(new NavigatorCustomButton[] { btnDtlAdd, btnDtlInsert, btnDtlDelete });
}
grid.EndInit();
}