Ejemplo n.º 1
0
 private void tableLayoutPanel1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         EditContextMenu.Show(Cursor.Position);
     }
 }
Ejemplo n.º 2
0
        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;
            }
        }