void OnSelectedNode(object sender, MouseEventArgs e) { TreeListHitInfo _hitinfo = _treeList.CalcHitInfo(e.Location); if (_hitinfo.Column != null && _hitinfo.Node != null) { //TreeListNode node = _hitinfo.Node; this._node = _hitinfo.Node; if (this._node != null) { if (this._node.HasChildren && AnySelect == false) { _labelMsg.Text = "请选中叶子节点"; _labelMsg.ForeColor = Color.Red; return; } _labelMsg.ForeColor = Color.Green; InnerValue = ConvertUtil.ToString(this._node.GetValue(ValueFieldName)); this.EditValue = this._node.GetValue(DisplayFieldName); //selectNodeDesc = string.Empty; //this.EditValue = GetAllDisplayField(node); } this.ClosePopup(); } }
private void toolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e) { try { if (e.SelectedControl is DevExpress.XtraTreeList.TreeList) { TreeList tree = (TreeList)e.SelectedControl; TreeListHitInfo hit = tree.CalcHitInfo(e.ControlMousePosition); if (hit.HitInfoType == HitInfoType.Cell) { object cellInfo = new TreeListCellToolTipInfo(hit.Node, hit.Column, null); string toolTip = $"{videos.FirstOrDefault(t => t.Id == int.Parse(hit.Node[hit.Column].ToString())).Name}"; //string.Format("{0} (Column: {1}, Node ID: {2})", hit.Node[hit.Column], //hit.Column.VisibleIndex, hit.Node.Id); e.Info = new DevExpress.Utils.ToolTipControlInfo(cellInfo, toolTip); } } } catch (Exception) { TreeList tree = (TreeList)e.SelectedControl; TreeListHitInfo hit = tree.CalcHitInfo(e.ControlMousePosition); object cellInfo = new TreeListCellToolTipInfo(hit.Node, hit.Column, null); string toolTip = $"{hit.Node[hit.Column]}"; e.Info = new DevExpress.Utils.ToolTipControlInfo(cellInfo, toolTip); } }
private void repositoryItemCheckEditIsOpen_CheckedChanged(object sender, EventArgs e) { var checkEdit = sender as CheckEdit; TreeListHitInfo hitInfo = treeListLayerList.CalcHitInfo(checkEdit.Location); var data = treeListLayerList.GetRow(hitInfo.Node.Id) as LayerItemModel; foreach (var item in mapBoxMainWindow.Map.Layers) { if (item.LayerName == data.LayerName) { item.Enabled = !data.IsVisible; } } var rec = this.OpenedTables.FirstOrDefault(async => async.TableName == data.LayerName); if (rec != null) { rec.IsOpen = !data.IsVisible; } mapBoxMainWindow.Refresh(); }
private void treeList_DoubleClick(object sender, EventArgs e) { //检查数据是否加载 if (_dataTable == null) { return; } //检查是否允许修改 if (!AllowUpdate) { return; } //有效焦点节点检查 if (this.treeList.FocusedNode == null) { return; } //点击测试,如果点击在单元格中则编辑 Point point = this.treeList.PointToClient(Control.MousePosition); TreeListHitInfo hi = this.treeList.CalcHitInfo(point); if (hi.HitInfoType == HitInfoType.Cell) { UpdateTreeRow(); } }
/// <summary> /// 为节点提供Tooltip /// 说明: /// 1.设置tree.ToolTipController属性 /// 2.ToolTipController的GetActiveObjectInfo事件中使用 /// 3.举例 /// tlLHData.CustomNodeTooltip(e, node => ///{ /// string _cabId = node.GetKeyID(); /// CCabInfo _cabinfo = LHDBHelper.GetCabInfo(_cabId); /// if (_cabinfo != null) /// { /// return string.Format("核对时间:{0}\r\n在线情况:{1}\r\n最后一次活跃时间:{2}\r\n", /// _cabinfo.ChkDataTime, /// _cabinfo.CtuOnlineStatus == 1 ? "在线" : "未上线", /// _cabinfo.LastAliveTime); /// } /// return string.Empty; ///}); /// </summary> /// <param name="tree">TreeList</param> /// <param name="e">ToolTipControllerGetActiveObjectInfoEventArgs</param> /// <param name="builderNodeTooltipFactory">委托</param> public static void CustomNodeTooltip(this TreeList tree, ToolTipControllerGetActiveObjectInfoEventArgs e, Func <TreeListNode, string> builderNodeTooltipFactory) { if (e.SelectedControl is DevExpress.XtraTreeList.TreeList) { TreeList _tree = (TreeList)e.SelectedControl; TreeListHitInfo _hit = _tree.CalcHitInfo(e.ControlMousePosition); if (_hit.HitInfoType == HitInfoType.Cell) { TreeListViewInfo _viewInfo = _tree.ViewInfo; RowInfo _rowInfo = _viewInfo.GetRowInfoByPoint(e.ControlMousePosition); CellInfo _cellInfo = _rowInfo.Cells[_hit.Column.VisibleIndex] as CellInfo; EditHitInfo _editHitInfo = _cellInfo.EditorViewInfo.CalcHitInfo(e.ControlMousePosition); if (_editHitInfo.HitTest == EditHitTest.MaskBox) { string _toolTip = builderNodeTooltipFactory(_hit.Node); if (!string.IsNullOrEmpty(_toolTip)) { e.Info = new ToolTipControlInfo(_cellInfo, _toolTip); } } } } }
private void treeList1_MouseMove(object sender, MouseEventArgs e) { TreeList treelist = sender as DevExpress.XtraTreeList.TreeList; TreeListHitInfo info = treelist.CalcHitInfo(new Point(e.X, e.Y)); HotTrackNode = info.HitInfoType == HitInfoType.Cell ? info.Node : null; }
void ViewTree_MouseUp(object sender, MouseEventArgs e) { TreeList tree = sender as TreeList; if (e.Button == MouseButtons.Right && ModifierKeys == Keys.None && tree.State == TreeListState.Regular) { Point pt = tree.PointToClient(MousePosition); TreeListHitInfo info = tree.CalcHitInfo(pt); if (info.HitInfoType == HitInfoType.Cell || info.HitInfoType == HitInfoType.StateImage) { tree.FocusedNode = info.Node; MyData obj = (MyData)this.GetDataRecordByNode(info.Node); if (obj == null || obj.InnerData == null) { return; } if (obj.InnerData is STViewGroupsInfo) { GroupContextMenu.ShowPopup(MousePosition); } else if (obj.InnerData is STViewsInfo) { ViewContextMenu.ShowPopup(MousePosition); } } else if (info.HitInfoType == HitInfoType.Empty) { RootContextMenu.ShowPopup(MousePosition); } } }
private void treeListPersonTemplate_MouseMove(object sender, MouseEventArgs e) { try { if (e.Button == MouseButtons.Left && m_IsAllowDrop) { TreeList list = (TreeList)sender; if ((list.FocusedNode != null) && (list.FocusedNode.Tag is TempletItem)) { DoDragDorpInfo(list); } } else { m_IsAllowDrop = false; } TreeListHitInfo hitInfo = treeListPersonTemplate.CalcHitInfo(new Point(e.X, e.Y)); if (hitInfo.Node != null) { if (hitInfo.Node.GetValue("NODETYPE").ToString() == "Leaf" && hitInfo.Node.Tag is TempletItem) { TempletItem item = (TempletItem)hitInfo.Node.Tag; InitToolTip(null == item ? "" : item.Content, treeListPersonTemplate, treeListPersonTemplate.PointToScreen(e.Location)); } } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
private void treeRole_MouseClick(object sender, MouseEventArgs e) { // 复选框控制 TreeListHitInfo hitInfo = treeRole.CalcHitInfo(new Point(e.X, e.Y)); TreeListNode node = hitInfo.Node; treeRole.FocusedNode = node; treeRole.UncheckAll(); if (null != node) { node.CheckState = CheckState.Checked; } else { return; } treeRole.ContextMenuStrip = cmsRoles; // 加载右边的详情树 if (null != treeRole.FocusedNode && treeRole.FocusedNode.Level != 0) // 点击的是非根节点 { CurrRole = treeRole.FocusedNode.Tag as ORUP_ROLE; treeRole.ContextMenuStrip = cmsRole; } }
private void tlGroup_DragDrop(object sender, DragEventArgs e) { try { if (cbeGroup.Text == string.Empty || cbeGroup.Properties.Items.Count == 0) { if (MsgBox.Confirm(Resource.GetString(Resource.Strings.PlayListTimeSliceGroupControlGroupItemCountEmpty), MessageBoxButtons.YesNo) == DialogResult.Yes) { EditGroup(string.Empty); } return; } if (e.Data.GetDataPresent(typeof(LibraryNode))) { _node = (LibraryNode)e.Data.GetData(typeof(LibraryNode)); //Is not message if (_node.Tag == null || ((LibraryItem)(_node.Tag)) == null) { return; } if (((LibraryItem)(_node.Tag)).Type == LibraryType.Message) { _adpater = ((MessageInfo)(_node.Tag)).ToProxy() as MessageAdapterInfo; //Message length is not equal the group length if (_adpater.Target.Length == 0) { MsgBox.Error(Resource.GetString(Resource.Strings.PlayListMessageLengthIsZero)); return; } _adpater.TargetId = _adpater.Target.Id; //LibraryGroup.Current.Messages.GetByName(((MessageInfo)(_node.Tag)).Name).IsLock = true; TreeListNode node = tlGroup.AppendNode(_adpater.ToArrayTimeSliceGroupItem(_currentGroup.Length), -1, _adpater); _nodesList.Add(node); if (_nodesList.Count == 1) { tlGroup.FocusedNode = node; SetDefaultNailImage(); } Save(); } } else { if (e.Data.GetDataPresent("DevExpress.XtraTreeList.Nodes.TreeListNode", false)) { _node = (TreeListNode)e.Data.GetData(typeof(TreeListNode)); TreeListHitInfo hInfo = tlGroup.CalcHitInfo(tlGroup.PointToClient(new Point(e.X, e.Y))); _sourceNode = _node; _destinationNode = hInfo.Node; //Save(); } } } catch (Exception ex) { DataGate.Log.Error(Resource.GetString(Resource.Strings.PlayListTimeSliceGroupControlDragDropException), ex); } }
// Правой кнопкой мыши вызываем контекстное меню public void tlStructure_MouseClick(System.Object sender, System.Windows.Forms.MouseEventArgs e) { TreeList tl = sender; TreeListHitInfo hitinfo = tl.CalcHitInfo(e.Location); if (this.tlStructure.Nodes.Count == 0) { return; } if (e.Button == System.Windows.Forms.MouseButtons.Right) { // если меню вызвано вне строк, можно только добавить филиал if (hitinfo.InRowCell == false || Information.IsDBNull(this.tlStructure.FocusedNode["ParentId"])) { this.btnEditRecord.Enabled = false; this.btnDeleteRecord.Enabled = false; this.btnAddGroup.Enabled = false; this.btnAddRoleJob.Enabled = false; this.btnSetCurrentFilial.Enabled = false; this.btnAddFilial.Enabled = true; this.PopupMenu.ShowPopup(MousePosition); } else { this.btnEditRecord.Enabled = true; this.btnDeleteRecord.Enabled = true; this.btnAddFilial.Enabled = this.tlStructure.FocusedNode.Level == 0; this.btnAddGroup.Enabled = this.tlStructure.FocusedNode.Level == 1; this.btnAddRoleJob.Enabled = this.tlStructure.FocusedNode.Level == 2; this.btnAddMenu.Enabled = this.tlStructure.FocusedNode.Level < 3; this.btnSetCurrentFilial.Enabled = this.tlStructure.FocusedNode.Level == 1; this.PopupMenu.ShowPopup(MousePosition); } } }
private void treeList1_MouseDown(object sender, MouseEventArgs e) { _HitInfo = treeList1.CalcHitInfo(new Point(e.X, e.Y)); if (_HitInfo.Node == null) { return; } _CurrentCategory = (CategoryTree)treeList1.GetDataRecordByNode(_HitInfo.Node); lblCurrentCategory.Text = _CurrentCategory.Name; mAddNewCategory.Enabled = _CurrentCategory.IsCategory; if (_CurrentCategory.IsCategory) { mRemove.Text = "Remove category"; } else { mRemove.Text = "Remove rule"; } treeList1.SetFocusedNode(_HitInfo.Node); if (e.Button == System.Windows.Forms.MouseButtons.Left) { treeList1.DoDragDrop(_CurrentCategory, DragDropEffects.Move); } }
public BarItem GetDraggingItem(Point location) { // your logic here BarItem item = null; if (SelectedControl is GridControl) { GridControl grid = SelectedControl as GridControl; if (grid != null) { GridView view = grid.MainView as GridView; if (view != null) { GridHitInfo hitInfo = view.CalcHitInfo(location); item = view.GetRow(hitInfo.RowHandle) as BarItem; } } } if (SelectedControl is TreeList) { TreeList treeList = SelectedControl as TreeList; if (treeList != null) { TreeListHitInfo hitInfo = treeList.CalcHitInfo(location); item = treeList1.GetDataRecordByNode(hitInfo.Node) as BarItem; } } return(item); }
public virtual void TreeMouseMove(MouseEventArgs e) { if (_hitInfo == null) { return; } if (_hitInfo.Node == null) { return; } if (e.Button != MouseButtons.Left) { return; } if (mouseDidNotReallyMove(e, _hitInfo)) { return; } _dragDropInfo = new DragDropInfo(getSelectedTreeNodes()); try { _treeView.DoDragDrop(_dragDropInfo, DragDropEffects.Move); DXMouseEventArgs.GetMouseArgs(e).Handled = true; } finally { _hitInfo = null; _dragDropInfo = null; } }
/// <summary> /// 右击TreeList弹出右键菜单 /// xlb 2013-01-19 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeListInpat_MouseUp(object sender, MouseEventArgs e) { try { barCheckItemDel.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; if (e.Button == MouseButtons.Right) { TreeListHitInfo hitInfo = treeListInpat.CalcHitInfo(e.Location); if (hitInfo != null && hitInfo.Node != null) { treeListInpat.FocusedNode = hitInfo.Node; TreeListNode node = hitInfo.Node; if (node != null && node.Tag is InPatientSim) { //节点是父节点右键删除不可用 barButtonItemDel.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; //父节点右键新增可使用 barButtonItemAdd.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; } else if (node != null && node.Tag is InCommonNoteEnmtity) { //子节点右键删除可用 barButtonItemDel.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; //子节点右键新增隐藏 barButtonItemAdd.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; } popupMenu1.ShowPopup(treeListInpat.PointToScreen(new Point(e.X, e.Y))); } } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
private void treeBusinessData_MouseClick(object sender, MouseEventArgs e) { // 复选框控制 TreeListHitInfo hitInfo = treeBusinessData.CalcHitInfo(new Point(e.X, e.Y)); TreeListNode node = hitInfo.Node; treeBusinessData.FocusedNode = node; treeBusinessData.UncheckAll(); if (null != node) { node.CheckState = CheckState.Checked; } else { return; } treeBusinessData.ContextMenuStrip = cmsBusinessDatas; // 加载右边的详情树 if (null != treeBusinessData.FocusedNode && treeBusinessData.FocusedNode.Level != 0) // 点击的是非根节点 { CurrBusinessData = treeBusinessData.FocusedNode.Tag as SYS_BUSINESSDATA; treeBusinessData.ContextMenuStrip = cmsBusinessData; } }
private void tlCategory_MouseUp(object sender, MouseEventArgs e) { TreeList tl = sender as TreeList; if (e.Button == MouseButtons.Right && ModifierKeys == Keys.None && tl.State == TreeListState.Regular) { Point p = new Point(Cursor.Position.X, Cursor.Position.Y); TreeListHitInfo hitInfo = tl.CalcHitInfo(e.Location); if (hitInfo.HitInfoType == HitInfoType.Cell) { tl.SetFocusedNode(hitInfo.Node); } if (tl.FocusedNode != null) { if (Convert.ToInt32(tl.FocusedNode.GetValue(tcId)) == 0) { this.barBtnAddChild.Visibility = BarItemVisibility.Always; this.barBtnDeleteCurrent.Visibility = BarItemVisibility.Never; this.barBtnAddPeer.Visibility = BarItemVisibility.Never; } else { foreach (BarButtonItemLink item in this.popupMenu1.ItemLinks) { item.Item.Visibility = BarItemVisibility.Always; } } popupMenu1.ShowPopup(p); } } }
private void treeListStockCat_MouseDown(object sender, MouseEventArgs e) { TreeListHitInfo hitInfo = treeListStockCat.CalcHitInfo(new Point(e.X, e.Y)); /*如果单击到单元格内*/ if (hitInfo.HitInfoType == HitInfoType.Cell) { WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA); waitForm.Show(); try { TreeListNodeTag tag = hitInfo.Node.Tag as TreeListNodeTag; textCatName.Text = hitInfo.Node.GetDisplayText(0); textCatCode.Text = tag.Cid; if (!hitInfo.Node.HasChildren) { Init(hitInfo.Node); } waitForm.Close(); } catch (Exception ex) { waitForm.Close(); } } }
private void defaultToolTipController1_DefaultController_GetActiveObjectInfo(object sender, ToolTipControllerGetActiveObjectInfoEventArgs e) { if (e.SelectedControl is DevExpress.XtraTreeList.TreeList) { TreeList tree = (TreeList)e.SelectedControl; TreeListHitInfo hit = tree.CalcHitInfo(e.ControlMousePosition); if (hit.HitInfoType == HitInfoType.Cell) { object cellInfo = new TreeListCellToolTipInfo(hit.Node, hit.Column, null); string toolTip = string.Empty; object remark = hit.Node.GetValue("CODE"); object name = hit.Node.GetValue("NAME"); if (remark != null) { toolTip = remark.ToString(); } else if (name != null) { toolTip = name.ToString(); } //string toolTip = remark == null ? hit.Node.GetValue("NAME").ToString() : remark.ToString(); e.Info = new DevExpress.Utils.ToolTipControlInfo(cellInfo, toolTip); } } }
private void TreeProjectFiles_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && Control.ModifierKeys == Keys.None) { dragFiles_StartHitInfo = (sender as TreeList).CalcHitInfo(new Point(e.X, e.Y)); } }
private void treeLayer_MouseUp(object sender, MouseEventArgs e) { try { if (e.Button == System.Windows.Forms.MouseButtons.Left && System.Windows.Forms.Control.ModifierKeys == System.Windows.Forms.Keys.None) { TreeListHitInfo treeListHitInfo = this.treeLayer.CalcHitInfo(e.Location); if (treeListHitInfo.HitInfoType == HitInfoType.Cell) { this.treeLayer.SetFocusedNode(treeListHitInfo.Node); } if (treeListHitInfo.Node != null) { object obj = treeListHitInfo.Node.GetValue("NodeObject"); if (obj == null) { return; } // } } } catch (Exception ex) { } }
private void treeList1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Left && Control.ModifierKeys == Keys.None) { dragStartHitInfo = (sender as TreeList).CalcHitInfo(new Point(e.X, e.Y)); } }
private void treeList1_Click(object sender, EventArgs e) { TreeList tree = sender as TreeList; TreeListHitInfo hi = tree.CalcHitInfo(tree.PointToClient(MousePosition)); if (hi.Node != null) { //Reset lblCreateBy.Text = ""; lblCreateDate.Text = ""; lblModifyBy.Text = ""; lblModifyDate.Text = ""; //Renew if (!string.IsNullOrEmpty(hi.Node.GetDisplayText("CreateDate"))) { lblCreateDate.Text = UtilityFunction.DateTimeToString(Convert.ToDateTime(hi.Node.GetDisplayText("CreateDate"))); } lblCreateBy.Text = hi.Node.GetDisplayText("CreateBy"); if (!string.IsNullOrEmpty(hi.Node.GetDisplayText("ModifyDate"))) { lblModifyDate.Text = UtilityFunction.DateTimeToString(Convert.ToDateTime(hi.Node.GetDisplayText("ModifyDate"))); } lblModifyBy.Text = hi.Node.GetDisplayText("ModifyBy"); } }
private void treeListHistory_MouseDoubleClick(object sender, MouseEventArgs e) { try { TreeListHitInfo hitInfo = treeListHistory.CalcHitInfo(e.Location); if (hitInfo != null && hitInfo.Node != null) { TreeListNode node = hitInfo.Node; EmrModel model = node.Tag as EmrModel; if (model != null) { //弹出病历内容 HistoryEmrForm printForm = new HistoryEmrForm(m_patUtil, m_RecordDal, model, node); printForm.ShowDialog(); if (CurrentForm != null) { CurrentForm.Focus(); } if (printForm.IsNeedInsertContent && CurrentForm != null) { if (CanEdit()) { CurrentForm.zyEditorControl1.EMRDoc._Paste(); Clipboard.Clear(); } } } } } catch (Exception ex) { throw ex; } }
// private void treeList1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { TreeListHitInfo hi = treeList1.CalcHitInfo(treeList1.PointToClient(new Point(e.X, e.Y))); DragObject dobj = GetDragObject(e.Data); if (dobj != null) { TreeListNode node = hi.Node; if (hi.HitInfoType == HitInfoType.Empty || node != null) { node = treeList1.AppendNode(dobj.DragData, node); node.StateImageIndex = dobj.ImageIndex; treeList1.MakeNodeVisible(node); TreeListNode parentNode = node.ParentNode; if (parentNode != null && (e.KeyState & 4) != 0) { int index = -1; if (parentNode.ParentNode != null) { index = parentNode.ParentNode.Nodes.IndexOf(parentNode); } treeList1.MoveNode(node, parentNode.ParentNode); treeList1.SetNodeIndex(node, index); } } } SetDefaultCursor(); }
private void tlItem_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { TreeListHitInfo hInfo = tlItem.CalcHitInfo(new Point(e.X, e.Y)); if (hInfo.HitInfoType == HitInfoType.Cell) { //SetCheckedNode(hInfo.Node); if (hInfo.Column.FieldName == "TEST4") { hInfo.Node.SetValue("TEST4", true); hInfo.Node.SetValue("TEST6", false); } else if (hInfo.Column.FieldName == "TEST6") { hInfo.Node.SetValue("TEST4", false); hInfo.Node.SetValue("TEST6", true); } else if (hInfo.Column.FieldName == "LAST_ORDER") { if (hInfo.Node.GetValue("LAST_ORDER").ToString().ToUpper() == "TRUE") { hInfo.Node.SetValue("LAST_ORDER", false); } else { hInfo.Node.SetValue("LAST_ORDER", true); } } } } }
private void list_DoubleClick(object sender, EventArgs e) { TreeList tree = sender as TreeList; TreeListHitInfo hi = tree.CalcHitInfo(tree.PointToClient(Control.MousePosition)); if (hi.Node != null) { if (hi.Node.StateImageIndex == 0) { // It's a folder string tag = hi.Node.Tag.ToString(); if (tag != CurrentDirectory) { previousDirectories.Push(CurrentDirectory); nextDirectories.Clear(); } TraverseDirectory(tag); } else { // It's a file FileAction(Action.OPEN); } } }
private void treeListTransacciones_MouseUp(object sender, MouseEventArgs e) { try { TreeList tl = (TreeList)sender; TreeListHitInfo hitInfo = tl.CalcHitInfo(e.Location); if (hitInfo.Node != null) { Info_seg_Menu_Item_Seleccionado_Transaccion = new seg_Menu_Item_Info(); Info_seg_Menu_Item_Seleccionado_Transaccion = (seg_Menu_Item_Info)treeListTransacciones.GetDataRecordByNode(hitInfo.Node); tl.FocusedNode = hitInfo.Node; hitInfo.Node.Expanded = true; NodoSeleccionado_Transaccion = hitInfo.Node; ucSeg_Propiedades1.Mostrar_Propiedades(ETipoObjectoSelect.Item); ucSeg_Propiedades1.Set_Propiedades(Info_seg_Menu_Item_Seleccionado_Transaccion); } } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", 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 treeListJobsAll_MouseUp(object sender, MouseEventArgs e) { try { TreeListHitInfo hit = treeListJobsAll.CalcHitInfo(new Point(e.X, e.Y)); barButtonItemAdd.Visibility = BarItemVisibility.Always; barButtonItemDelete.Visibility = BarItemVisibility.Always; barButtonItemEdit.Visibility = BarItemVisibility.Always; if (e.Button == MouseButtons.Right) { if (hit.Node != null) { barButtonItemAdd.Visibility = BarItemVisibility.Always; barButtonItemDelete.Visibility = BarItemVisibility.Always; barButtonItemEdit.Visibility = BarItemVisibility.Always; treeListJobsAll.FocusedNode = hit.Node; treeListJobsAll.Focus(); popupMenu1.ShowPopup(treeListJobsAll.PointToScreen(new Point(e.X, e.Y))); } else { barButtonItemAdd.Visibility = BarItemVisibility.Never; barButtonItemDelete.Visibility = BarItemVisibility.Never; barButtonItemEdit.Visibility = BarItemVisibility.Never; } } } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(ex.Message); } }
/// <summary> /// 右键弹出菜单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeListDiagRep_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { TreeListHitInfo hitInfo = treeListDiagRep.CalcHitInfo(e.Location); if (hitInfo != null && hitInfo.Node != null) { treeListDiagRep.Focus(); treeListDiagRep.FocusedNode = hitInfo.Node; //focusNode = hitInfo.Node; TreeListNode node = hitInfo.Node; //判断父节点是否为空 //if (node.HasChildren)//有子节点,点击的是父节点 if (node.ParentNode == null) //父节点为空,本身是父节点 { btnAddParent.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; //新增父节点 barButtonItemNew2.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; //新增子节点 barButtonItemModified2.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; //修改内容 barButtonItemDelet2.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; //删除 } else { //判断本节点自身是否是父节点 //取得parentnode ,将他作为node再查上级node(查不出数据或者PARENT_NODE为0 则为父节点?) //parentNode = treeListDiagRep.FocusedNode.GetValue("PARENT_NODE").ToString(); btnAddParent.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; //新增父节点 barButtonItemNew2.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; //新增子节点 barButtonItemModified2.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; //修改内容 barButtonItemDelet2.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; //删除 } } popupMenu1.ShowPopup(treeListDiagRep.PointToScreen(new Point(e.X, e.Y))); } }
private bool IsRightScroll(TreeListHitInfo hitInfo) { if (tree.ViewInfo.HasFixedRight) { return hitInfo.MousePoint.X > tree.ViewInfo.ViewRects.FixedRight.Left - ScrollIndent; } return hitInfo.MousePoint.X > tree.ViewInfo.ViewRects.ClipRectangle.Right - ScrollIndent; }
private bool CanScroll(TreeListHitInfo hitInfo) { return tree.State == TreeListState.ColumnDragging && hitInfo.HitInfoType == HitInfoType.Column; }
private bool IsLeftScroll(TreeListHitInfo hitInfo) { if (tree.ViewInfo.HasFixedLeft) { return hitInfo.MousePoint.X < tree.ViewInfo.ViewRects.FixedLeft.Right + ScrollIndent; } return hitInfo.MousePoint.X < tree.ViewInfo.ViewRects.ClipRectangle.X + ScrollIndent; }
private void treeList1_MouseDown(object sender, MouseEventArgs e) { _HitInfo = treeList1.CalcHitInfo(new Point(e.X, e.Y)); if (_HitInfo.Node == null) return; _CurrentCategory = (CategoryTree)treeList1.GetDataRecordByNode(_HitInfo.Node); lblCurrentCategory.Text = _CurrentCategory.Name; mAddNewCategory.Enabled = _CurrentCategory.IsCategory; if (_CurrentCategory.IsCategory) mRemove.Text = "Remove category"; else mRemove.Text = "Remove rule"; treeList1.SetFocusedNode(_HitInfo.Node); if (e.Button == System.Windows.Forms.MouseButtons.Left) { treeList1.DoDragDrop(_CurrentCategory, DragDropEffects.Move); } }
private void treeList_MouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left || ModifierKeys != Keys.None) return; var tl = sender as TreeList; if (tl != null) _dragStartHitInfo = tl.CalcHitInfo(e.Location); }
private void tlCategory_MouseDown(object sender, MouseEventArgs e) { hitInfoCategory = tlCategory.CalcHitInfo(new Point(e.X, e.Y)); }