GridControl表格自定义按钮设置按钮图片|C/S开发框架
替换前:
替换后:
DevStyle.SetGridButtonImage(gcDetail, "Add", Globals.LoadImage("24_detail_import_order.png"));
/// <summary>
/// 设置表格按钮的图片
/// </summary>
/// <param name="grid"></param>
/// <param name="buttonTag"></param>
/// <param name="image"></param>
public static void SetGridButtonImage(GridControl grid, string buttonTag, Image image)
{
var btn = GetButtonByTag(grid.EmbeddedNavigator.Buttons, buttonTag);
if (btn != null)
{
if (grid.EmbeddedNavigator.Buttons.ImageList is ImageList imglist)
{
imglist.Images[btn.ImageIndex] = image;
}
}
}
扫一扫加作者微信