Skip to main content
 首页 » 编程设计

devexpress GridControl 根据条件确定按钮是否有效

2022年07月19日117daizhj

/// <summary>
/// 绘制Button事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void repositoryItemButtonEdit1_CustomDrawButton(object sender, DevExpress.XtraEditors.Controls.CustomDrawButtonEventArgs e)
{
//根据按钮的位置获取其选择的行
var hitIno = gridView1.CalcHitInfo(e.Bounds.Location);
if (hitIno.RowHandle < 0)
{
return;
}
DataRow row = gridView1.GetDataRow(hitIno.RowHandle);
if (e.Button.Caption == "曲线回放")
{
if (Convert.ToByte(row["state"]) == 3)
{
e.Button.Enabled = true;
}
else
{
e.Button.Enabled = false;
}
}
}


本文参考链接:https://www.cnblogs.com/xihong2014/p/15124194.html
阅读延展