如何在按下鼠标右键时显示​​下拉列表/菜单?

问题描述

我正在尝试创建,这样,当我单击人民币时,会创建一个下拉列表/菜单。我对下拉菜单的定义将在下面附上。我被事件处理程序困住了,我过滤掉了甚至是LMB或RMB,然后我在这里遇到了问题。

首先,我的要求是,当我单击“人民币”时我已经设计了一张地图,我需要一个下拉菜单,以便选择合适的选项。

enter image description here

我的下拉列表定义

this.UserControl_MissionPlan_MapPanel_MourseRightClick = new ComboBox();
        this.UserControl_MissionPlan_MapPanel_MourseRightClick.Location = new System.Drawing.Point(700,700);
        this.UserControl_MissionPlan_MapPanel_MourseRightClick.Size = new System.Drawing.Size(120,120);
        this.UserControl_MissionPlan_MapPanel_MourseRightClick.DropDownStyle = ComboBoxStyle.DropDownList;
        this.UserControl_MissionPlan_MapPanel_MourseRightClick.MaxLength = 5;
        this.UserControl_MissionPlan_MapPanel_MourseRightClick.Items.Add(1);
        this.UserControl_MissionPlan_MapPanel_MourseRightClick.Items.Add(2);
        this.UserControl_MissionPlan_MapPanel_MourseRightClick.Items.Add(3);
        this.UserControl_MissionPlan_MapPanel_MourseRightClick.Items.Add(4);
        this.UserControl_MissionPlan_MapPanel_MourseRightClick.Items.Add(5);

最后是我的事件处理程序

        private void UserControl_MissionPlan_MapPanel_MouseClick(object sender,MouseEventArgs e)
    {
        if (e.Button == System.Windows.Forms.MouseButtons.Left)
        {
            double WaypointLatitude = UserControl_MissionPlan_MapPanel.FromLocalToLatLng(e.X,e.Y).Lat;
            double WaypointLongitude = UserControl_MissionPlan_MapPanel.FromLocalToLatLng(e.X,e.Y).Lng;
            //  MessageBox.Show(Convert.ToString(WaypointLatitude));
            //  MessageBox.Show(Convert.ToString(WaypointLongitude));

            //  GMapOverlay NavigationWayPoint = new GMapOverlay("NavigationWayPoint");
            //  GMapMarker WayPoint = new GMarkerGoogle(new PointLatLng(WaypointLatitude,WaypointLongitude),GMarkerGoogleType.orange_small);
            //  NavigationWayPoint.Markers.Add(WayPoint);
            //  UserControl_MissionPlan_MapPanel.Overlays.Add(NavigationWayPoint);
        }
        else if (e.Button == System.Windows.Forms.MouseButtons.Right)
        {
            
            //  MessageBox.Show("Right Mouse button Mouse clicked");
        }
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...