其他分享
首页 > 其他分享> > C1FlexGrid 右击菜单ContextMenuStrip

C1FlexGrid 右击菜单ContextMenuStrip

作者:互联网

1.有单元格右击,不显示菜单。
2.现在窗体加入控件ContextMenuStrip。
private void fgMain_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
int row = this.fgMain.MouseRow;
int col = this.fgMain.MouseCol;

    if (row < 1 || col < 1)
    {
        return;
    }

    this.fgMain.Focus();
    this.fgMain.Select(row, col);

    if ((row == 1 && col == 1))
    {
        return;
    }

    if (this.fgMain.Rows.Count > 30)
    {
        this.fgMain.ContextMenuStrip = this.menuFG;
        this.fgMain.ContextMenuStrip.Show(Cursor.Position);
    }
}

}

private void fgMain_BeforeMouseDown(object sender, BeforeMouseDownEventArgs e)
{
this.fgMain.ContextMenuStrip = null;
}

标签:右击,C1FlexGrid,int,fgMain,private,col,ContextMenuStrip,row
来源: https://www.cnblogs.com/-jwj/p/15003116.html