// 测试属性值对话框 private void menuItem_test_Click(object sender, EventArgs e) { CategoryPropertyDlg dlg = new CategoryPropertyDlg(); MainForm.SetControlFont(dlg, this.DefaultFont); dlg.CfgFileName = Environment.CurrentDirectory + "\\userrightsdef.xml"; dlg.ShowDialog(this); }
/* // 编辑权限 private void menu_editRights_Click(object sender, System.EventArgs e) { if (this.SelectedItems.Count == 0) { MessageBox.Show("尚未选择要编辑的事项..."); return; } DigitalPlatform.CommonDialog.PropertyDlg dlg = new DigitalPlatform.CommonDialog.PropertyDlg(); NodeInfo nodeinfo = (NodeInfo)this.SelectedItems[0].Tag; dlg.StartPosition = FormStartPosition.CenterScreen; dlg.Text = "对象 '"+ this.SelectedItems[0].Text +"' 的权限"; dlg.PropertyString = nodeinfo.Rights; dlg.CfgFileName = this.ResTree.PropertyCfgFileName; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) return; for(int i=0;i<this.SelectedItems.Count;i++) { // 令显示正确 this.SelectedItems[i].SubItems[1].Text = dlg.PropertyString; // 令内存正确 nodeinfo = (NodeInfo)this.SelectedItems[i].Tag; nodeinfo.Rights = dlg.PropertyString; if (nodeinfo.Rights == "") this.SelectedItems[i].ForeColor = SystemColors.GrayText; // ControlPaint.LightLight(nodeNew.ForeColor); else this.SelectedItems[i].ForeColor = SystemColors.WindowText; nodeinfo.TreeNode.ForeColor = this.SelectedItems[i].ForeColor; this.ResTree.SetNodeRights(nodeinfo.TreeNode, nodeinfo.Rights); } this.ResTree.Changed = true; } */ // 编辑权限 private void menu_editRights_Click(object sender, System.EventArgs e) { if (this.SelectedItems.Count == 0) { MessageBox.Show("尚未选择要编辑的事项..."); return; } DigitalPlatform.CommonDialog.CategoryPropertyDlg dlg = new DigitalPlatform.CommonDialog.CategoryPropertyDlg(); NodeInfo nodeinfo = (NodeInfo)this.SelectedItems[0].Tag; string strRights = ""; DialogResult result = this.ResTree.NodeRightsDlg(nodeinfo.TreeNode, out strRights); if (result != DialogResult.OK) return; // this.ResTree.SetNodeRights(nodeinfo.TreeNode, strRights); for (int i = 0; i < this.SelectedItems.Count; i++) { nodeinfo = (NodeInfo)this.SelectedItems[i].Tag; // nodeinfo.Rights = strRights; this.ResTree.SetNodeRights(nodeinfo.TreeNode, strRights); } }