• ZedGraph右键菜单怎样禁止它弹出(转)


    private void ZGC_ContextMenuBuilder( ZedGraphControl sender,
                         ContextMenuStrip menuStrip, Point mousePt,
                         ZedGraphControl.ContextMenuObjectState objState )
            {
                try
                {
                    #region //去掉不用的键

                    //去掉其他菜单选项可以把set_default改为对应的字符串。
                    //title_def         标题
                    //copy              复制
                    //copied_to_clip    复制到剪贴板
                    //page_setup        页面设置...
                    //print             打印...
                    //save_as           另存图表...
                    //set_default       恢复默认大小
                    //show_val          显示节点数值
                   
                    //unzoom            还原缩放
                    //unpan             还原移动
                    //undo_all          还原缩放/移动
                   
                    //x_title_def       X 轴
                    //y_title_def       Y 轴
                          
                    //每个循环只能遍历一个键
                    foreach( ToolStripMenuItem item in menuStrip.Items )
                    {
                        if( ( string )item.Tag == "set_default" )                // “恢复默认大小”菜单项
                        {
                            menuStrip.Items.Remove( item );//移除菜单项
                            item.Visible = false; //不显示
                            break;
                        }
                    }
                    foreach( ToolStripMenuItem item in menuStrip.Items )
                    {
                        if( ( string )item.Tag == "copy" )                // “复制”菜单项
                        {
                            menuStrip.Items.Remove( item );//移除菜单项
                            item.Visible = false; //不显示
                            break;
                        }
                    }
                    foreach( ToolStripMenuItem item in menuStrip.Items )
                    {
                        if( ( string )item.Tag == "page_setup" )                // “页面设置”菜单项
                        {
                            menuStrip.Items.Remove( item );//移除菜单项
                            item.Visible = false; //不显示
                            break;
                        }
                    }
                    foreach( ToolStripMenuItem item in menuStrip.Items )
                    {
                        if( ( string )item.Tag == "print" )                // “打印”菜单项
                        {
                            menuStrip.Items.Remove( item );//移除菜单项
                            item.Visible = false; //不显示
                            break;
                        }
                    }
                    foreach( ToolStripMenuItem item in menuStrip.Items )
                    {
                        if( ( string )item.Tag == "save_as" )                // “另存为”菜单项
                        {
                            menuStrip.Items.Remove( item );//移除菜单项
                            item.Visible = false; //不显示
                            break;
                        }
                    }
                    #endregion
                }
                catch( System.Exception ex )
                {
                    MessageBox.Show( "Error Code: 112,初始化右键菜单错误" + ex.ToString( ) );
                }
            }
            #endregion

    //**如果完全不需要显示的话,就用 zedCntrol.IsShowContextMenu = false;

  • 相关阅读:
    CSS——清除浮动
    .net 多线程之线程取消
    .net 多线程临时变量
    NPOI helper
    添加学员存储过程
    SQL-sqlHelper001
    ado.net 中事务的使用
    T-SQL 事务2
    T-SQL 事务
    T-SQL 带参数存储过程
  • 原文地址:https://www.cnblogs.com/xihong2014/p/4213116.html
Copyright © 2020-2023  润新知