コード例 #1
0
ファイル: CarView.cs プロジェクト: shakandrew/Cars-WinForms
 private void tableLayoutPanel1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         EditContextMenu.Show(Cursor.Position);
     }
 }
コード例 #2
0
        /// <summary>
        /// Initializes all items on menu bar.
        /// </summary>
        private void InitializeContextMenus()
        {
            UMLMenuItem     fileMenu        = new UMLMenuItem("File");
            FileContextMenu fileContextMenu = new FileContextMenu();

            fileMenu.DropDown = fileContextMenu;
            Items.Add(fileMenu);

            UMLMenuItem     editMenu        = new UMLMenuItem("Edit");
            EditContextMenu editContextMenu = new EditContextMenu();

            editMenu.DropDown = editContextMenu;
            Items.Add(editMenu);
        }
コード例 #3
0
ファイル: MainMap.cs プロジェクト: devgis/2014_MapApp
        private void mapControl1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                pNodePoint = e.Location;
                if (String.IsNullOrEmpty(_TempMWSFilePath))
                {
                    //地图未打开 右键菜单不激活!
                    return;
                }

                if (String.IsNullOrEmpty(AdminPassword))
                {
                    InputPassWDForm frmIPWDF = new InputPassWDForm();
                    if (frmIPWDF.ShowDialog() == DialogResult.OK)
                    {
                        String ConfigPassword = String.Empty;
                        try
                        {
                            ConfigPassword = System.Configuration.ConfigurationManager.AppSettings["AdminPassWord"].ToString();
                        }
                        catch
                        {
                        }
                        if (String.IsNullOrEmpty(ConfigPassword))
                        {
                            MessageBox.Show("密码配置错误!");
                            return;
                        }
                        if (!MD5Help.MD5Encrypt(frmIPWDF.PassWord).Equals(ConfigPassword))
                        {
                            MessageBox.Show("密码错误!");
                            return;
                        }
                        else
                        {
                            AdminPassword = ConfigPassword;
                            foreach (IMapLayer imapLayer in mapControl1.Map.Layers)
                            {
                                if (imapLayer.Alias.Equals("JKINFO"))
                                {
                                    LayerHelper.SetEditable(imapLayer, true);
                                    LayerHelper.SetInsertable(imapLayer, true);
                                    LayerHelper.SetSelectable(imapLayer, true);
                                }
                                else
                                {
                                    LayerHelper.SetEditable(imapLayer, false);
                                    LayerHelper.SetInsertable(imapLayer, false);
                                    LayerHelper.SetSelectable(imapLayer, false);
                                }
                            }
                            MessageBox.Show("登陆成功!");
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                //mapControl1.ContextMenuStrip = EditContextMenu;
                //MessageBox.Show("登陆成功!");
                EditContextMenu.Show(e.Location);
            }
            else
            {
                //SelectedFeature = null;
            }
        }