private void treeList1_DragDrop(object sender, DragEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hi = treeList1.CalcHitInfo(treeList1.PointToClient(new Point(e.X, e.Y))); //DragObject dobj = GetDragObject(e.Data); TreeListNode dragNode = e.Data.GetData(typeof(TreeListNode)) as TreeListNode; DragObject dobj = e.Data.GetData(typeof(TreeListNode)) as DragObject; if (dragNode != null) { TreeListNode node = hi.Node; if (hi.HitInfoType == HitInfoType.Empty || node != null) { TreeListNode parentNode = node.ParentNode; int index = -1; treeList1.MoveNode(dragNode, node, true); treeList1.SetNodeIndex(dragNode, index); } //if (treeList1.FocusedNode.Level == 1) // treeList1.FocusedNode.ImageIndex = 1; //else // treeList1.FocusedNode.ImageIndex = 2; } (sender as DevExpress.XtraTreeList.TreeList).EndCurrentEdit(); tblWorkFlowTableAdapter2.Update(dSWorkFlow); }
private void toolTipController_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e) { if (e.SelectedControl == storeLoadTree) { DevExpress.XtraTreeList.TreeListHitInfo hit = storeLoadTree.CalcHitInfo(e.ControlMousePosition); if (hit.HitInfoType == HitInfoType.StateImage) { object o = (object)hit.Node; int imageIndex = hit.Node.StateImageIndex; string toolText = String.Empty; switch (imageIndex) { case 2: toolText = "Кассета не загружена"; break; case 3: toolText = "Кассета частично загружена"; break; case 4: toolText = "Кассета загружена полностью"; break; } e.Info = new ToolTipControlInfo(o, toolText); } } }
private void ShowHitInfo(DevExpress.XtraTreeList.TreeListHitInfo hi) { if (hi.Node != null) { XtraMessageBox.Show(hi.Node.GetValue(_trName).ToString()); } }
private void treeListLocalFile_MouseDoubleClick(object sender, MouseEventArgs e) { m_SelectedFiles = null; DevExpress.XtraTreeList.TreeListHitInfo info = treeListLocalFile.CalcHitInfo(e.Location); if (info.Node != null) { m_SelectedFiles = new List <string>(); foreach (TreeListNode node in treeListLocalFile.Selection) { if (!node.HasChildren) { string file = node.GetValue(0).ToString(); if (File.Exists(file)) { m_SelectedFiles.Add(file); } } } if (m_SelectedFiles.Count > 0 && FilesDoubleClicked != null) { FilesDoubleClicked(this, EventArgs.Empty); } m_SelectedFiles = null; } }
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); } } }
protected override void OnClick(EventArgs e) { base.OnClick(e); MouseEventArgs e1 = e as MouseEventArgs; if (e1 != null) { DevExpress.XtraTreeList.TreeListHitInfo info = this.CalcHitInfo(e1.Location); if (info.Node == null) { this.CloseEditor(); } } }
void uxTree_DoubleClick(object sender, EventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hi = uxTree.CalcHitInfo(uxTree.PointToClient(Control.MousePosition)); if (hi.Node != null) { if (hi.Node.Level == 2) { dsTree.TreeRow row = (uxTree.GetDataRecordByNode(hi.Node) as DataRowView).Row as dsTree.TreeRow; if (FileSelected != null) { FileSelected(this, new EventArgs()); } } } }
private void treeListLocalFile_MouseDown(object sender, MouseEventArgs e) { treeListLocalFile.ContextMenuStrip = null; DevExpress.XtraTreeList.TreeListHitInfo info = treeListLocalFile.CalcHitInfo(e.Location); if (info.Node != null) { if (info.Node.GetDisplayText("Type") == "File") { startPoint = e.Location; dragFileList = new string[1]; dragFileList[0] = (string)info.Node.GetValue(0);; isDoDrag = true; } } }
private void tlTaskTree_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DevExpress.XtraTreeList.TreeListHitInfo hitInfo = (sender as DevExpress.XtraTreeList.TreeList).CalcHitInfo(new Point(e.X, e.Y)); tlTaskTree.Selection.Set(hitInfo.Node); tlTaskTree.FocusedNode = hitInfo.Node; focused = hitInfo.Node; string type = hitInfo.Node.GetDisplayText("Type"); initPopupMenu(type); if (hitInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell && !type.Equals("J")) { popupMenu1.ShowPopup(barManager1, Control.MousePosition); } } }
private void treeListAPIHelper_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = treeListAPIHelper.CalcHitInfo(new Point(e.X, e.Y)); TreeListNode node = hInfo.Node; if (node == null) { return; } // Toggle Checkbox if (e.Button == MouseButtons.Right) { treeListAPIHelper.FocusedNode = node; treeListAPIHelper.FocusedColumn = hInfo.Column; //treeListAPI.InvalidateNodes(); } }
private void treeList1_DragOver(object sender, DragEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hi = treeList1.CalcHitInfo(treeList1.PointToClient(new Point(e.X, e.Y))); DevExpress.XtraTreeList.Nodes.TreeListNode node = GetDragNode(e.Data); if (node != null) { if (hi.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Empty || hi.Node != null) { e.Effect = DragDropEffects.Copy; } else { e.Effect = DragDropEffects.None; } } SetDragCursor(e.Effect); tblWorkFlowTableAdapter2.Update(dSWorkFlow); }
private void treeList1_MouseDoubleClick(object sender, MouseEventArgs e) { try { DevExpress.XtraTreeList.TreeList tree = sender as DevExpress.XtraTreeList.TreeList; DevExpress.XtraTreeList.TreeListHitInfo info = tree.CalcHitInfo(tree.PointToClient(MousePosition)); if (info.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) { TreeListNode node = info.Node; tree.FocusedNode = node; AddLayerToMapControl(node); } } catch { } }
//弹出右键菜单 private void treeList_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DevExpress.XtraTreeList.TreeListHitInfo hi = treeList.CalcHitInfo(e.Location); if (hi != null) { if (hi.Node != null) { treeList.FocusedNode = hi.Node; if (hi.Node.Level >= 0 && isManageMode) { this.popupMenuTree.ShowPopup(MousePosition); } } } } }
private void tgv_MouseMove(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = tgv.CalcHitInfo(new Point(e.X, e.Y)); if (hInfo.Node == null || hInfo.Column == null) { if (Cursor != Cursors.Default) { Cursor = Cursors.Default; } return; } if (hInfo.Column.AbsoluteIndex == 2 && hInfo.Node.GetValue(2).ToString() == "System.Drawing.Bitmap") { if (Cursor != Cursors.Hand) { Cursor = Cursors.Hand; } } else if (hInfo.Column.AbsoluteIndex == 4 && hInfo.Node.GetValue(4).ToString() == "System.Drawing.Bitmap") { if (Cursor != Cursors.Hand) { Cursor = Cursors.Hand; } } else { if (Cursor != Cursors.Default) { Cursor = Cursors.Default; } } }
private void treeList1_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = treeList1.CalcHitInfo(new Point(e.X, e.Y)); TreeListNode node = hInfo.Node; if (node == null) { return; } // Toggle Checkbox if (e.Button == MouseButtons.Left) { if (hInfo.HitInfoType == HitInfoType.StateImage) { bool isChecked = node.StateImageIndex == 1; if (isChecked) { node.StateImageIndex = 0; node[3] = ""; node[4] = ""; } else { node.StateImageIndex = 1; if (string.IsNullOrEmpty((string)node[3])) { node[3] = "="; } if (string.IsNullOrEmpty((string)node[4])) { node[4] = "And"; } } } } else { treeList1.FocusedNode = node; } if (Owner.IsAddingNewFilter) { string filterName = string.Format("Get{0}By", Owner.Filter.Parent.Alias); bool empty = true; foreach (TreeListNode nodeToCheck in treeList1.Nodes) { if (nodeToCheck.StateImageIndex == 1) { if (!empty) { filterName += "And"; } empty = false; filterName += ((ArchAngel.Providers.Database.Model.Column)nodeToCheck.Tag).Alias; } } Owner.Filter.Name = filterName; } }
private void tgv_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = tgv.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; } tgv.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; } TreeListNode ownerNode = node; while (ownerNode != null && ownerNode.Tag == null) { ownerNode = ownerNode.ParentNode; } if (ownerNode == null) { return; } switch (action) { case "Import >": if (node.Tag == null) { // Parent is a FileContainer string parentText = node.ParentNode.GetValue(0).ToString(); FileContainer fc = (FileContainer)node.ParentNode.Tag; string propertyName = node.GetValue(1).ToString(); switch (propertyName) { case "": break; default: throw new NotImplementedException("Not coded yet."); } Populate(); } else if (node.Tag.GetType() == typeof(FolderContainer)) { Stack <FolderContainer> folderStack = new Stack <FolderContainer>(); TreeListNode parentNode = node; bool matchingAncestorFound = false; OutputFolder myTopFolder = null; while (parentNode.ParentNode != null) { FolderContainer fc = (FolderContainer)parentNode.Tag; if (fc.MyFolder != null) { matchingAncestorFound = true; myTopFolder = fc.MyFolder; break; } folderStack.Push(fc); parentNode = parentNode.ParentNode; } if (!matchingAncestorFound) { FolderContainer fc = folderStack.Pop(); OutputFolder topLevelFolder = fc.TheirFolder; myTopFolder = new OutputFolder(topLevelFolder.Name, topLevelFolder.Id); myTopFolder.IteratorType = topLevelFolder.IteratorType; frmTemplateSyncWizard.MyProject.AddTopLevelFolder(myTopFolder); } while (folderStack.Count > 0) { FolderContainer fc = folderStack.Pop(); OutputFolder theirFolder = fc.TheirFolder; OutputFolder newFolder = new OutputFolder(theirFolder.Name, theirFolder.Id); newFolder.IteratorType = theirFolder.IteratorType; myTopFolder.Folders.Add(newFolder); } Populate(); } else // FileContainer { OutputFile theirFile = ((FileContainer)node.Tag).TheirFile; OutputFolder folder = null; bool isTopLevelNode = node.ParentNode.ParentNode == null; if (!isTopLevelNode) { folder = ((FolderContainer)node.ParentNode.Tag).MyFolder; } OutputFile newFile = new OutputFile(theirFile.Name, theirFile.FileType, theirFile.ScriptName, theirFile.Id); newFile.StaticFileIterator = theirFile.StaticFileIterator; newFile.StaticFileName = theirFile.StaticFileName; // Copy new function as well, if it doesn't already exist if (!string.IsNullOrEmpty(theirFile.ScriptName)) { FunctionInfo myFunction = frmTemplateSyncWizard.MyProject.FindFunctionSingle(theirFile.ScriptName); if (myFunction == null) { FunctionInfo theirFunction = frmTemplateSyncWizard.TheirProject.FindFunctionSingle(theirFile.ScriptName); frmTemplateSyncWizard.MyProject.AddFunction(theirFunction); newFile.IteratorFunction = frmTemplateSyncWizard.MyProject.FindFunctionSingle(theirFile.ScriptName); } } if (!isTopLevelNode) { folder.Files.Add(newFile); } else { frmTemplateSyncWizard.MyProject.AddTopLevelFile(newFile); } Populate(); } break; case "Apply Change >": string propertyName2 = node.GetValue(0).ToString(); if (node.ParentNode.Tag.GetType() == typeof(FolderContainer)) { FolderContainer fc2 = (FolderContainer)node.ParentNode.Tag; switch (propertyName2) { case "Iterator Type": fc2.MyFolder.IteratorType = fc2.TheirFolder.IteratorType; break; default: throw new NotImplementedException("Not coded yet: " + propertyName2); } } else if (node.ParentNode.Tag.GetType() == typeof(FileContainer)) { FileContainer fileContainer = (FileContainer)node.ParentNode.Tag; switch (propertyName2) { case "File Type": fileContainer.MyFile.FileType = fileContainer.TheirFile.FileType; break; case "Script Name": fileContainer.MyFile.ScriptName = fileContainer.TheirFile.ScriptName; break; case "Static File Iterator": fileContainer.MyFile.StaticFileIterator = fileContainer.TheirFile.StaticFileIterator; break; case "Static File Name": fileContainer.MyFile.StaticFileName = fileContainer.TheirFile.StaticFileName; break; default: throw new NotImplementedException("Not coded yet: " + propertyName2); } } else { throw new NotImplementedException("Not coded yet:" + node.ParentNode.Tag.GetType().FullName); } break; case "Remove": // Parent is a FileContainer string parentText2 = node.ParentNode.GetValue(0).ToString(); if (node.Tag.GetType() == typeof(FolderContainer)) { ((FolderContainer)node.ParentNode.Tag).MyFolder.RemoveFolder(((FolderContainer)node.Tag).MyFolder); } else if (node.Tag.GetType() == typeof(FileContainer)) { ((FolderContainer)node.ParentNode.Tag).MyFolder.RemoveFile(((FileContainer)node.Tag).MyFile); } else { throw new NotImplementedException("Not coded yet: " + node.Tag.GetType().FullName); } Populate(); break; default: throw new NotImplementedException("ActionType not handled yet: " + action); } }
private void treeList_DragDrop(object sender, DragEventArgs e) { if (!isManageMode) { e.Effect = DragDropEffects.None; EF.EFMessageBox.Show(EP.EPES.EPESC0000071 /*操作失败!请进入维护模式进行排序操作!*/, EP.EPES.EPESC0000024 /*提示*/, MessageBoxButtons.OK, MessageBoxIcon.Error); TreeListNode parent = treeList.FocusedNode.ParentNode; queryChildNodes(parent); return; } DevExpress.XtraTreeList.TreeListHitInfo hi = treeList.CalcHitInfo(treeList.PointToClient(new Point(e.X, e.Y))); string[] format = e.Data.GetFormats(); //拖拽的是菜单树中的节点——节点排序 if (format[0] == "DevExpress.XtraTreeList.Nodes.TreeListNode") { if (hi != null) { if (hi.Node != null) { TreeListNode dragnode = e.Data.GetData(typeof(TreeListNode)) as TreeListNode; TreeListNode targetnode = hi.Node; treeList.SetNodeIndex(dragnode, treeList.GetNodeIndex(targetnode)); OrderNodes(hi.Node.ParentNode); } } e.Effect = DragDropEffects.None; } //拖拽的是画面信息列表框中的行——新增画面 else { TreeListNode parentNode = null; int treeseq = 0; //拖拽至画面节点 if (hi.Node.ImageIndex == FORMICON) { parentNode = hi.Node.ParentNode; } //拖拽至目录节点 else { parentNode = hi.Node; } treeseq = parentNode.Nodes.Count; //新增画面 DataSet inBlock = new DataSet(); inBlock.Tables.Add(); inBlock.Tables[0].Columns.Add("fname"); inBlock.Tables[0].Columns.Add("name"); inBlock.Tables[0].Columns.Add("resname"); inBlock.Tables[0].Columns.Add("description"); inBlock.Tables[0].Columns.Add("shortcut"); inBlock.Tables[0].Columns.Add("treeno"); inBlock.Tables[0].Columns.Add("treeseq"); inBlock.Tables[0].Columns.Add("userid"); for (int i = 0, j = 1; i < this.gridViewFormInfo.RowCount; i++) { //取出选中行 if (fgDevGridFormInfo.GetSelectedColumnChecked(i)) { if (treeseq > 999) { EFMessageBox.Show(EP.EPES.EPESC0000072 /*新增失败*/, EP.EPES.EPESC0000024 /*提示*/, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DataRow dr = inBlock.Tables[0].NewRow(); dr["name"] = parentNode.Tag + gridViewFormInfo.GetRowCellValue(i, "NAME").ToString(); dr["description"] = parentNode.Tag + gridViewFormInfo.GetRowCellValue(i, "DESCRIPTION").ToString(); dr["resname"] = parentNode.Tag + gridViewFormInfo.GetRowCellValue(i, "NAME").ToString(); dr["fname"] = parentNode.Tag; dr["shortcut"] = " "; dr["treeno"] = 0; dr["treeseq"] = treeseq.ToString("d3"); treeseq++; j++; } } int flag = DbTreeInfo.AddTreeNode(inBlock, CConstString.ConnectName); if (flag == 0) { queryChildNodes(parentNode); //取消列表框中所有checkbox选中状态 for (int k = 0; k < gridViewFormInfo.DataRowCount; k++) { fgDevGridFormInfo.SetSelectedColumnChecked(k, false);// gridViewFormInfo..SetRowCellValue(k, gridColumnFormCheck, false); } this.gridViewFormInfo.Invalidate(); } } }
private void treeList1_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = treeList1.CalcHitInfo(new Point(e.X, e.Y)); TreeListNode node = hInfo.Node; if (node == null) { return; } // Toggle Checkbox if (e.Button == MouseButtons.Left) { if (hInfo.HitInfoType == HitInfoType.StateImage) { bool isChecked = node.StateImageIndex == 1; if (isChecked) { node.StateImageIndex = 0; node[2] = ""; //TreeListNode lastSelectedNode = node; //while (lastSelectedNode.NextNode != null && lastSelectedNode.NextNode.StateImageIndex == 1) //{ // lastSelectedNode = lastSelectedNode.NextNode; //} //if (lastSelectedNode != node) //{ // int index = treeList1.GetNodeIndex(lastSelectedNode); // treeList1.SetNodeIndex(node, index); // treeList1.Selection.Clear(); // treeList1.FocusedNode = treeList1.Nodes[0]; // //treeList1.SetFocusedNode(treeList1.Nodes[0]); // //treeList1.Selection.Set(treeList1.Nodes[0]); //} } else { node.StateImageIndex = 1; if (string.IsNullOrEmpty((string)node[2])) { node[2] = "ASC"; } //TreeListNode firstNonSelectedNode = node; //while (firstNonSelectedNode.PrevNode != null && firstNonSelectedNode.PrevNode.StateImageIndex == 0) //{ // firstNonSelectedNode = firstNonSelectedNode.PrevNode; //} //if (firstNonSelectedNode != node) //{ // int index = treeList1.GetNodeIndex(firstNonSelectedNode); // treeList1.SetNodeIndex(node, treeList1.GetNodeIndex(firstNonSelectedNode)); // treeList1.Selection.Clear(); // treeList1.FocusedNode = treeList1.Nodes[0]; // //treeList1.SetFocusedNode(treeList1.Nodes[0]); // //treeList1.Selection.Set(treeList1.Nodes[0]); //} if (string.IsNullOrEmpty((string)node[3])) { node[3] = "="; } if (string.IsNullOrEmpty((string)node[4])) { node[4] = "And"; } } } } else { treeList1.FocusedNode = node; } }
private void tlistAccountbook_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraTreeList.TreeListHitInfo hi = tlistAccountbook.CalcHitInfo(e.Location); if (hi.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) { string selectedNode = hi.Node[Accountbooks].ToString(); switch (selectedNode) { case "Account Group Ledger": Reports.Accountbooks.AccountGroupLedger frmAccGrp = new Reports.Accountbooks.AccountGroupLedger(); frmAccGrp.StartPosition = FormStartPosition.CenterParent; frmAccGrp.ShowDialog(); break; case "Account Ledger": Reports.Accountbooks.AccountLedger frmAccLed = new Reports.Accountbooks.AccountLedger(); frmAccLed.ShowDialog(); break; case "Bank Book": Bankbook frmBook = new Bankbook(); frmBook.ShowDialog(); break; case "Cash Book Single": CashbookSingle frmCashbook = new CashbookSingle(); frmCashbook.ShowDialog(); break; case "Day Book": Daybook frmday = new Daybook(); frmday.ShowDialog(); break; case "Payment Register": PaymentRegister frmpay = new PaymentRegister(); frmpay.ShowDialog(); break; case "Purchase Register": PurchaseRegister frmpurc = new PurchaseRegister(); frmpurc.ShowDialog(); break; case "Purchase Return Register": PurchaseReturnRegister frmPurcre = new PurchaseReturnRegister(); frmPurcre.ShowDialog(); break; case "Receipt Register": RecepitRegister frmRece = new RecepitRegister(); frmRece.ShowDialog(); break; case "Sales Register": Saleregister frmsale = new Saleregister(); frmsale.ShowDialog(); break; case "Sales Return Register": SalesReturnRegister frmsaleret = new SalesReturnRegister(); frmsaleret.ShowDialog(); break; case "Sub Ledger": SubLedger frmsub = new SubLedger(); frmsub.ShowDialog(); break; default: break; } } //string selectedNode = (sender as TreeList).FocusedNode.GetValue(0).ToString(); }