private void treeList2_MouseDoubleClick(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeList gv = sender as DevExpress.XtraTreeList.TreeList; DevExpress.XtraTreeList.TreeListHitInfo hi = gv.CalcHitInfo(e.Location); if (hi.Node != null) { object o = gv.GetDataRecordByNode(hi.Node); DataRowView info = o as DataRowView; string str = string.Empty; if (info["LB"].Equals("清单")) { str = info["XMMC"].ToString(); } else { if (info["SSLB"].Equals(0)) { str = "分部分项"; } } if (str != string.Empty) { DataRowView view = this.bindingSource1.Current as DataRowView; if (view != null) { view.BeginEdit(); view["location"] = str; view.EndEdit(); this.treeList1.HideEditor(); } } } }
private void treeList1_DoubleClick(object sender, EventArgs e) { try { DevExpress.XtraTreeList.TreeList tree = sender as DevExpress.XtraTreeList.TreeList; DevExpress.XtraTreeList.TreeListHitInfo hi = tree.CalcHitInfo(tree.PointToClient(Control.MousePosition)); if (hi.Node != null) { CTechCore.Models.Navigation.Menus.MenuItem mnu = new CTechCore.Models.Navigation.Menus.MenuItem(((DataRowView)tree.GetDataRecordByNode(tree.Selection[0])).Row); if (mnu.DisplayAllFormBeforeLoad) { CTechCore.Models.Navigation.Menus.DisplayListAll(mnu); } else { CTechCore.Models.Navigation.Menus.LoadEntityForm(mnu); } } } catch (Exception ex) { string msg = $"Error loading screen : {ex.Message}.\r\n {ex.StackTrace}"; if (ex.InnerException != null) { msg += ex.InnerException.ToString(); } MessageBox.Show(msg); MyApp.Log.WriteEntry(msg, System.Diagnostics.EventLogEntryType.Error); } }
private void treeList1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (!_hasTotalRight) { return; } Point clickPoint = new Point(e.X, e.Y); DevExpress.XtraTreeList.TreeListHitInfo hInfo = treeList1.CalcHitInfo(new Point(e.X, e.Y)); if (hInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) //在单元格上右击了 { TreeListNode node = hInfo.Node; treeList1.FocusedNode = node; if (!_isApply && hInfo.Node != null && hInfo.Node.ParentNode != null && hInfo.Node.ParentNode.ParentNode != null && !hInfo.Node.HasChildren) { ToolStripMenuItemChangePrivate.Visible = ExtendApplicationContext.Current.LoginUser.isMDSD && hInfo.Node.ParentNode.ParentNode.GetDisplayText(0).Equals("私有"); if (ExtendApplicationContext.Current.LoginUser.isMDSD || hInfo.Node.ParentNode.ParentNode.GetDisplayText(0).Equals("私有") || _hasPublicTempletRight) { contextMenuStrip1.Show(treeList1, e.X, e.Y); } } } } }
//双击节点打开对应的文件 private void treeList2_MouseDoubleClick(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeList treelist = sender as DevExpress.XtraTreeList.TreeList; if (treelist == null) { return; } Point pt = new Point(e.X, e.Y); DevExpress.XtraTreeList.TreeListHitInfo ht = treeList2.CalcHitInfo(pt); if (ht != null && ht.Node != null) { var node = ht.Node; List <FilesTreeNode> data = treeList2.DataSource as List <FilesTreeNode>; string path = data[node.Id].FullName; string aLastName = path.Substring(path.LastIndexOf(".") + 1, (path.Length - path.LastIndexOf(".") - 1)); if (aLastName == "dwg") { if (!Project.Instance.OpenedDocs.Contains(path)) { var doc = Fs.openDwg(path); Project.Instance.OpenedDocs.Add(doc.Name); } } else { System.Diagnostics.Process.Start(path); } } }
private void treeListUser_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hiUser = treeListUser.CalcHitInfo(new Point(e.X, e.Y)); if (hiUser.Node != null) { // treeListUser.FocusedNode = hiUser.Node; } }
private void treeListGroup_MouseDown(object sender, MouseEventArgs e) { hiGroup = treeListGroup.CalcHitInfo(new Point(e.X, e.Y)); if (hiGroup.Node != null) { treeListGroup.FocusedNode = hiGroup.Node; } }
private void treeListForm_MouseDown(object sender, MouseEventArgs e) { hiTreeList = treeListForm.CalcHitInfo(new Point(e.X, e.Y)); if (hiTreeList.Node != null) { treeListForm.FocusedNode = hiTreeList.Node; } }
private void treeListEx1_MouseDoubleClick(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeList tl = sender as DevExpress.XtraTreeList.TreeList; DevExpress.XtraTreeList.TreeListHitInfo tinfo = tl.CalcHitInfo(e.Location); if (tinfo.Node != null) { sform.subSegmentListData1.FocusedNode(ToolKit.ParseInt(tinfo.Node.GetValue("ID"))); } }
private TreeListNode _TargetNodeAfterMouseRightClick;//右键点击以后的节点 private void trvLstMain_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeList tree = sender as DevExpress.XtraTreeList.TreeList; DevExpress.XtraTreeList.TreeListHitInfo hitInfo = tree.CalcHitInfo(e.Location); if (e.Button == MouseButtons.Right && hitInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) { _TargetNodeAfterMouseRightClick = hitInfo.Node; } }
private void treeList1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Left) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = treeList1.CalcHitInfo(new Point(e.X, e.Y)); if (hInfo.HitInfoType == HitInfoType.StateImage) { SetCheckedNode(hInfo.Node); } } }
/// <summary> /// 文档树右击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeList1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = this.TreeUser.treeList1.CalcHitInfo(new Point(e.X, e.Y)); if (hInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) //在单元格上右击了 { this.TreeUser.treeList1.ContextMenuStrip = this.contextMenuStrip1; userNode = hInfo.Node; } } }
private void treeListEx1_MouseDoubleClick(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeList gv = sender as DevExpress.XtraTreeList.TreeList; DevExpress.XtraTreeList.TreeListHitInfo hi = gv.CalcHitInfo(e.Location); if (hi.Node != null) { object obj = this.treeListEx1.GetDataRecordByNode(hi.Node); if (!this.treeListEx1.CheckNodes.Contains(obj)) { this.treeListEx1.CheckNodes.Add(obj); } this.DialogResult = DialogResult.OK; } }
private void ShowHitInfo(DevExpress.XtraTreeList.TreeListHitInfo hi) { //lbHitTest.Text = hi.HitInfoType.ToString(); //lbColumn.Text = hi.Column == null ? "No column" : hi.Column.GetCaption(); //lbNode.Text = hi.Node == null ? "-1" : hi.Node.Id.ToString(); //if (hi.Column == null || hi.Node == null) // lbCellValue.Text = " "; //else // lbCellValue.Text = hi.Node.GetDisplayText(hi.Column.AbsoluteIndex); if (hi.Node != null) { XtraMessageBox.Show(hi.Node.GetValue(_trName).ToString()); } }
private void treeList1_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo info = treeList1.CalcHitInfo(e.Location); if (info.Node != null) { object o = info.Node["Context"]; if (o is TaskUnitInfo) { isDragDrop = true; startPoint = e.Location; dragNode = info.Node; } } }
private void ucseg_menu_x_empresa_x_usuario1_event_delegate_treeList_menu_MouseDown(object sender, MouseEventArgs e) { try { DevExpress.XtraTreeList.TreeList tree = (DevExpress.XtraTreeList.TreeList)sender; DevExpress.XtraTreeList.TreeListHitInfo hitInfo = tree.CalcHitInfo(e.Location); if (hitInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) { SeleccionarNodo(hitInfo.Node); } } catch (Exception ex) { } }
private void ucseg_menu_x_empresa_x_usuario1_event_delegate_treeList_menu_MouseDown(object sender, MouseEventArgs e) { try { DevExpress.XtraTreeList.TreeList tree = (DevExpress.XtraTreeList.TreeList)sender; DevExpress.XtraTreeList.TreeListHitInfo hitInfo = tree.CalcHitInfo(e.Location); if (hitInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) { SeleccionarNodo(hitInfo.Node); } } catch (Exception) { MessageBox.Show("Ha ocurrido un error, comuníquese con sistemas", param.nom_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void treeList1_MouseUp(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeList gv = sender as DevExpress.XtraTreeList.TreeList; DevExpress.XtraTreeList.TreeListHitInfo hi = gv.CalcHitInfo(e.Location); if (e.Button == MouseButtons.Right) { if (this.Activitie == null) { return; } if (this.bindingSource1.Count > 0) { // this.popupMenu1.ShowPopup(Control.MousePosition); } } }
private void tvRoleRight_Click(object sender, EventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo tvHit = tvRoleRight.CalcHitInfo(tvRoleRight.PointToClient(Control.MousePosition));//((Control)sender).PointToClient(Control.MousePosition)); if (tvRoleRight.Nodes.Count > 0 && FormDataFlag != BWS.ERP.BasePublic.DataFlag.dsBrowse) { if (tvRoleRight.FocusedNode != null && tvHit.Column != null) { if (((MouseEventArgs)e).Button == MouseButtons.Right && tvHit.Column.FieldName == "sMenuName") { cmsRoleRight.Show(tvRoleRight, ((MouseEventArgs)e).X, ((MouseEventArgs)e).Y); } else { if (Control.ModifierKeys == Keys.Control && tvHit.Column.FieldName == "iView") { BatchDetail("iView", ((MouseEventArgs)e).X, ((MouseEventArgs)e).Y); } else if (Control.ModifierKeys == Keys.Control && tvHit.Column.FieldName == "iAdd") { BatchDetail("iAdd", ((MouseEventArgs)e).X, ((MouseEventArgs)e).Y); } else if (Control.ModifierKeys == Keys.Control && tvHit.Column.FieldName == "iEdit") { BatchDetail("iEdit", ((MouseEventArgs)e).X, ((MouseEventArgs)e).Y); } else if (Control.ModifierKeys == Keys.Control && tvHit.Column.FieldName == "iDelete") { BatchDetail("iDelete", ((MouseEventArgs)e).X, ((MouseEventArgs)e).Y); } else if (Control.ModifierKeys == Keys.Control && tvHit.Column.FieldName == "iPrint") { BatchDetail("iPrint", ((MouseEventArgs)e).X, ((MouseEventArgs)e).Y); } else if (Control.ModifierKeys == Keys.Control && tvHit.Column.FieldName == "iNum") { BatchDetail("iNum", ((MouseEventArgs)e).X, ((MouseEventArgs)e).Y); } else if (Control.ModifierKeys == Keys.Control && tvHit.Column.FieldName == "iPrice") { BatchDetail("iPrice", ((MouseEventArgs)e).X, ((MouseEventArgs)e).Y); } } } } }
//鼠标点击的节点设为焦点 private void treeList1_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeList treelist = sender as DevExpress.XtraTreeList.TreeList; if (treelist == null) { return; } Point pt = new Point(e.X, e.Y); DevExpress.XtraTreeList.TreeListHitInfo ht = treeList1.CalcHitInfo(pt); if (ht != null && ht.Node != null) { treeList1.FocusedNode = ht.Node; } treeList1.OptionsBehavior.Editable = false; treeList1.CloseEditor(); }
//弹出右键菜单 private void treeListMain_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DevExpress.XtraTreeList.TreeListHitInfo hi = treeListMain.CalcHitInfo(e.Location); if (hi != null) { if (hi.Node != null) { if ((treeListMain.Selection.Count != 0 && !treeListMain.Selection.Contains(hi.Node)) || treeListMain.Selection.Count == 0) { treeListMain.Selection.Clear(); treeListMain.Selection.Add(hi.Node); } } } } }
private void treeList_MouseClick(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hi = treeList.CalcHitInfo(new Point(e.X, e.Y)); if ((hi != null) && (hi.Column != null) && (hi.Column != colCompany) && (hi.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Column)) { SendMessageToLog(hi.HitInfoType.ToString()); this.tableLayoutPanelBgrnd.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.treeList)).BeginInit(); System.Int32 iCellFalseCount = 0; foreach (DevExpress.XtraTreeList.Nodes.TreeListNode objNode in treeList.Nodes) { if (System.Convert.ToBoolean(objNode.GetValue(hi.Column)) == false) { iCellFalseCount++; break; } } foreach (DevExpress.XtraTreeList.Nodes.TreeListNode objNode in treeList.Nodes) { objNode.SetValue(hi.Column, (iCellFalseCount > 0)); if (iCellFalseCount > 0) { foreach (DevExpress.XtraTreeList.Columns.TreeListColumn objColumn in treeList.Columns) { if ((objColumn != colCompany) && (objColumn != hi.Column)) { objNode.SetValue(objColumn, false); } } } } this.tableLayoutPanelBgrnd.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.treeList)).EndInit(); if (m_bDisableEvents == true) { return; } SetPropertiesModified(true); } }
void ucSeg_Menu_x_Usuario_x_Empresa1_event_treeListMenu_x_Usuario_x_Empresa_MouseDown(object sender, MouseEventArgs e) { try { DevExpress.XtraTreeList.TreeList tree = (DevExpress.XtraTreeList.TreeList)sender; DevExpress.XtraTreeList.TreeListHitInfo hitInfo = tree.CalcHitInfo(e.Location); if (hitInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) { SeleccionarNodo(hitInfo.Node); } } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; NameMetodo = NameMetodo + " - " + ex.ToString(); MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); } }
/// <summary> /// 文档树右击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeList1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = this.TreeDocTemplate.treeList1.CalcHitInfo(new Point(e.X, e.Y)); if (hInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) //在单元格上右击了 { if (hInfo.Node.Tag.GetType() == typeof(doc_template_tree)) { this.TreeDocTemplate.treeList1.ContextMenuStrip = this.contextMenuStrip1; node = hInfo.Node; } else { this.TreeDocTemplate.treeList1.ContextMenuStrip = this.contextMenuStrip2; selTreeNode = (doc_template)hInfo.Node.Tag; node = hInfo.Node; } } } }
/// <summary> /// 判断是文件夹还是文件点击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeList1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = this.treeList1.CalcHitInfo(new Point(e.X, e.Y)); if (hInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) //在单元格上右击了 { if (hInfo.Node.Tag.GetType() == typeof(document_tree)) { this.treeList1.ContextMenuStrip = this.contextMenuFiles; node = hInfo.Node; // 粘贴按钮不可用 //pasteItem.Enabled = false; } else { this.treeList1.ContextMenuStrip = this.contextMenuFile; node = hInfo.Node; selTreeNode = (document)hInfo.Node.Tag; } } } }
public static void FieldsSettingFormOpen() { var frm = new CoreLib.Label.FieldsSettingsFrm() { MdiParent = MdiParentForm, WindowState = FormWindowState.Maximized }; //Double click event frm.ObjectTree.DoubleClick += (s, e) => { var treeList1 = (DevExpress.XtraTreeList.TreeList)s; DevExpress.XtraTreeList.TreeListHitInfo hi = treeList1.CalcHitInfo(treeList1.PointToClient(Control.MousePosition)); if (hi.Node != null) { var objType = hi.Node["ObjectType"] ?? ""; var objId = hi.Node["Id"] ?? ""; var objName = hi.Node["Name"] ?? ""; if (objType.ToString() == "Table") { var currObj = (CoreLib.Label.UIObjectBase)frm.UIObjectBaseXPC.Lookup(objId); Args _args = new Args() { ParmObject = currObj.ObjectType() }; SimpleForm simpleFrm = new SimpleForm(_args) { WindowState = FormWindowState.Maximized, Text = currObj.ObjectName }; simpleFrm.ShowDialog(); } } }; frm.Show(); }
private void treeList1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (!_hasTotalRight) { return; } Point clickPoint = new Point(e.X, e.Y); DevExpress.XtraTreeList.TreeListHitInfo hInfo = treeList1.CalcHitInfo(new Point(e.X, e.Y)); if (hInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) //在单元格上右击了 { TreeListNode node = hInfo.Node; treeList1.FocusedNode = node; if (!_isApply && hInfo.Node != null) { toolStripMenuItemAdd.Visible = false;; toolStripMenuItemDelete.Visible = false; toolStripMenuItemRename.Visible = false; if (hInfo.Node.ParentNode != null && hInfo.Node.ParentNode.ParentNode != null && !hInfo.Node.HasChildren) { toolStripMenuItemAdd.Visible = false; toolStripMenuItemDelete.Visible = true; toolStripMenuItemRename.Visible = true; } else if (hInfo.Node.HasChildren || hInfo.Node.ParentNode == null || hInfo.Node.ParentNode.ParentNode == null) { toolStripMenuItemAdd.Visible = true; toolStripMenuItemDelete.Visible = false; toolStripMenuItemRename.Visible = false; } contextMenuStrip1.Show(treeList1, e.X, e.Y); } } } }
private void treeListRes_MouseDown(object sender, MouseEventArgs e) { hiTreeRes = treeListRes.CalcHitInfo(new Point(e.X, e.Y)); if (hiTreeRes.Node != null) { treeListRes.FocusedNode = hiTreeRes.Node; } }
private void treeListReferencedFiles_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = treeListReferencedFiles.CalcHitInfo(new Point(e.X, e.Y)); TreeListNode node = hInfo.Node; if (node == null || hInfo.Column == null || !(hInfo.Column.AbsoluteIndex == 2 || hInfo.Column.AbsoluteIndex == 4)) { return; } TreeListNode topNode = node; while (topNode.ParentNode != null) { topNode = topNode.ParentNode; } treeListReferencedFiles.FocusedNode = node; string action; switch (hInfo.Column.AbsoluteIndex) { case 2: action = node.GetValue(2).ToString(); if (!string.IsNullOrEmpty(action) && action == "System.Drawing.Bitmap") { object image = node.GetValue(2); if (image == GreenArrow) { action = "Import >"; } else if (image == BlueArrow) { action = "Apply Change >"; } } break; case 4: action = node.GetValue(4).ToString(); if (!string.IsNullOrEmpty(action) && action == "System.Drawing.Bitmap") { action = "Remove"; } break; default: return; } if (string.IsNullOrEmpty(action)) { return; } var topNodeText = (string)topNode.GetValue(0); switch (action) { case "Import >": switch (topNodeText) { case "Functions in single template": frmTemplateSyncWizard.MyProject.AddFunction(((FunctionContainer)node.Tag).TheirFunction); break; default: throw new NotImplementedException("Not coded yet: " + topNodeText); } break; case "Apply Change >": switch (topNodeText) { default: throw new NotImplementedException("Not coded yet: " + topNodeText); } case "Remove": switch (topNodeText) { case "Functions in single template": frmTemplateSyncWizard.MyProject.DeleteFunction(((FunctionContainer)node.Tag).MyFunction); break; default: throw new NotImplementedException("Not coded yet: " + topNodeText); } break; default: throw new NotImplementedException("ActionType not handled yet: " + action); } // Do any siblings remain? while (node.ParentNode != null) { if (node.ParentNode.Nodes.Count == 1) { node = node.ParentNode; } else // The parent has > 1 child { node.ParentNode.Nodes.Remove(node); return; } } treeListReferencedFiles.Nodes.Remove(node); }
private void treeTrayWaiting_MouseMove(object sender, MouseEventArgs e) { hi_drag = treeTrayWaiting.CalcHitInfo(new Point(e.X, e.Y)); if (hi_drag == null) return; if (e.Button != MouseButtons.Left) return; Rectangle dragRect = new Rectangle(new Point( hi_drag.MousePoint.X - SystemInformation.DragSize.Width / 2, hi_drag.MousePoint.Y - SystemInformation.DragSize.Height / 2), SystemInformation.DragSize); if (!dragRect.Contains(new Point(e.X, e.Y))) { if (hi_drag.Node.ParentNode == null) treeTrayWaiting.DoDragDrop(hi_drag.Node, DragDropEffects.Move); else { treeTrayWaiting.DoDragDrop(null, DragDropEffects.None); } } }
private void treeTrayWaiting_DragOver(object sender, DragEventArgs e) { DevExpress.XtraTreeList.TreeList tl = sender as DevExpress.XtraTreeList.TreeList; hi_over = tl.CalcHitInfo(tl.PointToClient(new Point(e.X, e.Y))); if (hi_over.Node != null && hi_drag.Node != null) { if (hi_over.Node != null && hi_over.Node.Level == 0) e.Effect = DragDropEffects.None; else { DevExpress.XtraTreeList.Nodes.TreeListNode node_drag = hi_drag.Node as DevExpress.XtraTreeList.Nodes.TreeListNode; DevExpress.XtraTreeList.Nodes.TreeListNode node_over = hi_over.Node as DevExpress.XtraTreeList.Nodes.TreeListNode; long idbatch_over = Convert.ToInt64(node_over.ParentNode.GetValue("Id")); // get father level 1 long idbatch_drag = Convert.ToInt64(node_drag.ParentNode.GetValue("Id")); if (idbatch_drag != idbatch_over) { int idtemplate_method_drag = Convert.ToInt32(node_drag.GetValue("Idtemplate_method")); CBatch oBatch_over = new CBatchFactory().GetByPrimaryKey(new CBatchKeys(idbatch_over)); if (oBatch_over.Status_process == 'W' && oBatch_over.Idtemplate_method == idtemplate_method_drag) e.Effect = DragDropEffects.Move; else// batch en proceso e.Effect = DragDropEffects.None; } else e.Effect = DragDropEffects.None; } } }
private void treeListDirectory_MouseClick(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hi = this.treeListDirectory.CalcHitInfo(new Point(e.X, e.Y)); if (hi.Node == null) { return; } this.barTool.Visible = false; this.isChangeByLoad = true; //MessageBox.Show("test"); NovelChapter nc = this.treeListDirectory.GetDataRecordByNode(hi.Node) as NovelChapter; if (nc != null) { if (nc.FileName != null && nc.FileName != string.Empty && nc.FileName != "") { if (nc.FileName.EndsWith(".txt", StringComparison.OrdinalIgnoreCase)) { if (File.Exists(this.book.LocalFolder + "\\" + nc.FileName)) { //FileStream fs = new FileStream(System.Windows.Forms.Application.StartupPath + "\\" + nc.FileName, FileMode.Open); StreamReader sr = new StreamReader(this.book.LocalFolder + "\\" + nc.FileName); string s = sr.ReadToEnd(); sr.Close(); //fs.Close(); this.memoEditTxt.Text = s; this.memoEditTxt.Tag = nc.FileName; } this.xtraScrollableControlImg.Visible = false; this.memoEditTxt.Visible = true; } else if (nc.FileName.EndsWith(".gif", StringComparison.OrdinalIgnoreCase) || nc.FileName.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase)) { this.xtraScrollableControlImg.Controls.Clear(); string[] filelist = nc.FileName.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); int imglocationheight = 10; for (int i = 0; i < filelist.Length; i++) { //MessageBox.Show(Application.ExecutablePath); //MessageBox.Show(this.book.LocalFolder + "\\" + filelist[i]);//http://www.biquge.com/0_46/ if (File.Exists(this.book.LocalFolder + "\\" + filelist[i])) { PictureEdit pe = new PictureEdit(); pe.Image = Image.FromFile(this.book.LocalFolder + "\\" + filelist[i]); pe.Size = new Size(pe.Image.Width, pe.Image.Height); pe.Location = new Point(0, imglocationheight); imglocationheight = imglocationheight + pe.Image.Height + 10; this.xtraScrollableControlImg.Controls.Add(pe); } else { } } this.xtraScrollableControlImg.Visible = true; this.memoEditTxt.Visible = false; } } } }
private void treeListMain_DragDrop(object sender, DragEventArgs e) { try { DevExpress.XtraTreeList.TreeListHitInfo hi = treeListMain.CalcHitInfo(treeListMain.PointToClient(new Point(e.X, e.Y))); TreeListNode parentNode = null; //拖拽至用户节点 if (hi.Node.ImageIndex == USERICON) { parentNode = hi.Node.ParentNode; } //拖拽至群组节点 else if (hi.Node.ImageIndex == GROUPICON) { parentNode = hi.Node; } DataSet inBlock = new DataSet(); inBlock.Tables.Add(); //为群组新增子组 if (tabbedControlGroup1.SelectedTabPage == layoutControlGroup3) { string parentGroup = ((List <string>)parentNode.Tag)[0]; if (parentGroup == "admingroup" || parentGroup == "formgroup" || parentGroup == "usermanager" || parentGroup == "groupmanager" || parentGroup == "resourcemanager") { EFMessageBox.Show(EP.EPES.EPESC0000193 /*系统群组下不可挂子组,请将角色用户直接添加到该组下!*/, EP.EPES.EPESC0000024 /*提示*/, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } inBlock.Tables[0].Columns.Add("ID"); inBlock.Tables[0].Columns.Add("userid"); string groupid = ((List <string>)parentNode.Tag)[1]; inBlock.Tables[0].Rows.Add(groupid, CConstString.UserId); inBlock.Tables.Add(); inBlock.Tables[1].Columns.Add("ID"); for (int i = 0; i < this.gridViewGroupInfo.RowCount; i++) { if (efDevGridGroupInfo.GetSelectedColumnChecked(i)) { string tmp = this.gridViewGroupInfo.GetRowCellValue(i, "ID").ToString(); if (groupid == tmp) { throw new Exception("拖动的组与父组一样."); } inBlock.Tables[1].Rows.Add(tmp); } } string msg = DbUserInfo.InsertGroupChildGroup(inBlock, CConstString.ConnectName); if (msg == "ok") { queryMember(parentNode); //取消列表框中所有checkbox选中状态 UnCheckAll(efDevGridGroupInfo, gridViewGroupInfo); } } //为群组新增子用户 else if (tabbedControlGroup1.SelectedTabPage == layoutControlGroup2) { inBlock.Tables[0].Columns.Add("groupid"); inBlock.Tables[0].Columns.Add("groupname"); inBlock.Tables[0].Columns.Add("user"); inBlock.Tables[0].Columns.Add("authmode"); inBlock.Tables[0].Rows.Add(((List <string>)parentNode.Tag)[1], ((List <string>)parentNode.Tag)[0], CConstString.UserId, 0); inBlock.Tables.Add(); inBlock.Tables[1].Columns.Add("userid"); inBlock.Tables[1].Columns.Add("username"); for (int i = 0; i < this.gridViewUserInfo.RowCount; i++) { if (efDevGridUserInfo.GetSelectedColumnChecked(i)) { inBlock.Tables[1].Rows.Add(this.gridViewUserInfo.GetRowCellValue(i, "ID"), this.gridViewUserInfo.GetRowCellValue(i, "ENAME")); } } DbUserInfo.InsertGroupChildUser(inBlock, CConstString.ConnectName); queryMember(parentNode); // 取消列表框中所有checkbox选中状态 UnCheckAll(efDevGridUserInfo, gridViewUserInfo); } treeListMain.OptionsBehavior.DragNodes = false; } catch (Exception ex) { EFMessageBox.Show(ex.Message + ex.StackTrace); } }