private void galleryControl_MouseUp(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } Point point = galleryControl.PointToClient(Control.MousePosition); RibbonHitInfo hitInfo = galleryControl.CalcHitInfo(point); if (hitInfo.InGalleryItem || hitInfo.HitTest == RibbonHitTest.GalleryImage) { item = hitInfo.GalleryItem; var list = db.GOIMONs.Where(m => m.HOADON.MaBan == item.Value.ToString()).ToList(); if (list.Count > 0) { popupMenu1.ShowPopup(barManager1, new Point(MousePosition.X, MousePosition.Y)); btnTinhTien.Enabled = true; btnInHoaDon.Enabled = true; } else { popupMenu3.ShowPopup(barManager1, new Point(MousePosition.X, MousePosition.Y)); btnTinhTien.Enabled = false; btnInHoaDon.Enabled = false; } } else { popupMenu1.HidePopup(); popupMenu2.ShowPopup(barManager1, new Point(MousePosition.X, MousePosition.Y)); } }
private void popupMenu1_BeforePopup(object sender, CancelEventArgs e) { (sender as DevExpress.XtraBars.PopupMenu).ItemLinks[0].Item.Enabled = true; (sender as DevExpress.XtraBars.PopupMenu).ItemLinks[1].Item.Enabled = false; Point point = galleryControl1.PointToClient(Control.MousePosition); RibbonHitInfo hitInfo = galleryControl1.CalcHitInfo(point); if (hitInfo.InGalleryItem || hitInfo.HitTest == RibbonHitTest.GalleryImage) { item = hitInfo.GalleryItem; } if (item != null) { var menulist = data.S_Menu(Convert.ToInt32(item.Value)).ToList(); RibbonPageGroup grp = Ribbon.Pages[1].Groups[0]; foreach (BarItemLink lnk in grp.ItemLinks) { if (lnk.Item.Name == menulist.FirstOrDefault().FormAdi) { (sender as DevExpress.XtraBars.PopupMenu).ItemLinks[0].Item.Enabled = false; (sender as DevExpress.XtraBars.PopupMenu).ItemLinks[1].Item.Enabled = true; } } } }
private void popupMenu1_Popup(object sender, EventArgs e) { Point point = galleryControl1.PointToClient(Control.MousePosition); RibbonHitInfo hitInfo = galleryControl1.CalcHitInfo(point); if (hitInfo.InGalleryItem || hitInfo.HitTest == RibbonHitTest.GalleryImage) { item = hitInfo.GalleryItem; } }
private void OnMouseDown(object sender, MouseEventArgs e) { RibbonControl ribbonControl = sender as RibbonControl; hitInfo = ribbonControl.CalcHitInfo(e.Location); if (!hitInfo.InToolbar || hitInfo.Item == null || hitInfo.Item is DevExpress.XtraBars.Ribbon.Internal.RibbonQuickToolbarBarItemLink) { hitInfo = null; } }
private void simpleButton1_Click(object sender, EventArgs e) { FieldInfo fi = typeof(RibbonControl).GetField("handler", BindingFlags.NonPublic | BindingFlags.Instance); Object b = fi.GetValue(ribbonControl1); MethodInfo mi = typeof(RibbonHandler).GetMethod("OnPressHeaderPage", BindingFlags.NonPublic | BindingFlags.Instance); RibbonHitInfo hi = new RibbonHitInfo(); hi.Page = ribbonPage2; mi.Invoke(b, new object[] { hi }); }
private void ToolTipController_GetActiveObjectInfo(object sender, ToolTipControllerGetActiveObjectInfoEventArgs e) { if (e.SelectedControl == RibbonControl) { RibbonHitInfo hitInfo = RibbonControl.CalcHitInfo(e.ControlMousePosition); if (hitInfo.InItem && hitInfo.Item is BarStaticItemLink) { e.Info = null; // don't show tooltip that is the same text as the BarStaticItemLlink } } }
private void OnSourceGalleryMouseDown(object sender, MouseEventArgs e) { GalleryControl galControl = (GalleryControl)sender; RibbonHitInfo hitInfo = galControl.CalcHitInfo(e.Location); if (hitInfo.InGalleryItem) { dragItemHitInfo = hitInfo; return; } dragItemHitInfo = null; }
private void OnDragOver(object sender, DragEventArgs e) { RibbonControl ribbonControl = sender as RibbonControl; Point point = ribbonControl.PointToClient(new Point(e.X, e.Y)); RibbonHitInfo hitInfo = ribbonControl.CalcHitInfo(point); e.Effect = DragDropEffects.None; if (hitInfo.InToolbar && hitInfo.Item != null && !(hitInfo.Item is DevExpress.XtraBars.Ribbon.Internal.RibbonQuickToolbarBarItemLink)) { e.Effect = DragDropEffects.Move; } }
private void OnDragDrop(object sender, DragEventArgs e) { RibbonControl ribbonControl = sender as RibbonControl; Point point = ribbonControl.PointToClient(new Point(e.X, e.Y)); RibbonHitInfo hitInfo = ribbonControl.CalcHitInfo(point); BarItemLink targetLink = hitInfo.Item; if (hitInfo.InToolbar && targetLink != null && !targetLink.Equals(link)) { ReorderItems(ribbonControl, targetLink); } link = null; }
private void OnGalleryControlDragOver(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(List <GalleryItem>))) { e.Effect = DragDropEffects.Move; } GalleryControl gallery = (GalleryControl)sender; RibbonHitInfo hitInfo = gallery.CalcHitInfo(gallery.PointToClient(new Point(e.X, e.Y))); targetHighlightItem = hitInfo.GalleryItem; gallery.Invalidate(); }
private void galleryControl1_MouseDown(object sender, MouseEventArgs e) { GalleryControl gc = sender as GalleryControl; RibbonHitInfo hInfo = gc.CalcHitInfo(e.Location); if (hInfo.InGalleryItem) { dragItemHitInfo = hInfo; ((DXMouseEventArgs)e).Handled = true; return; } dragItemHitInfo = null; }
private void OnGalleryControlMouseDown(object sender, MouseEventArgs e) { GalleryControl gallery = (GalleryControl)sender; RibbonHitInfo hitInfo = gallery.CalcHitInfo(e.Location); if (hitInfo.InGalleryItem) { DragItemHitInfo = hitInfo; DragSource = gallery; } else { DragItemHitInfo = null; } }
void galleryControlClient1_Paint(object sender, PaintEventArgs e) { GalleryControlClient client = sender as GalleryControlClient; if (dragItemHitInfo != null) { Point p = galleryControl1.PointToClient(Cursor.Position); RibbonHitInfo hitInfo = galleryControl1.CalcHitInfo(p); if (hitInfo.InGalleryGroup) { GalleryControlGalleryViewInfo info = galleryControl1.Gallery.GetViewInfo() as GalleryControlGalleryViewInfo; Rectangle rect = info.Groups[galleryControl1.Gallery.Groups.IndexOf(hitInfo.GalleryItemGroup)].Bounds; rect.Offset(0, client.Bounds.Top * -1); e.Graphics.DrawLine(new Pen(Color.PowderBlue, 3), new Point(rect.Left, rect.Bottom), new Point(rect.Right, rect.Bottom)); } } }
private void OnMouseMove(object sender, MouseEventArgs e) { RibbonControl ribbonControl = sender as RibbonControl; if (e.Button == MouseButtons.Left && hitInfo != null) { Size dragSize = SystemInformation.DragSize; Rectangle dragRect = new Rectangle(new Point(hitInfo.HitPoint.X - dragSize.Width / 2, hitInfo.HitPoint.Y - dragSize.Height / 2), dragSize); if (!dragRect.Contains(e.Location)) { link = hitInfo.Item; ribbonControl.DoDragDrop(link, DragDropEffects.Move); hitInfo = null; } } }
private void galleryControl1_DragDrop(object sender, DragEventArgs e) { if (!(e.Data.GetDataPresent(typeof(GalleryItem)))) { return; } GalleryItem draggedItem = e.Data.GetData(typeof(GalleryItem)) as GalleryItem; GalleryControl galControl = (GalleryControl)sender; RibbonHitInfo hitInfo = galControl.CalcHitInfo(galControl.PointToClient(new Point(e.X, e.Y))); if (hitInfo.InGalleryGroup) { draggedItem.GalleryGroup.Items.Remove(draggedItem); hitInfo.GalleryItemGroup.Items.Add((GalleryItem)draggedItem); } dragItemHitInfo = null; galleryControlClient1.Invalidate(); }
private void popupMenu1_BeforePopup(object sender, System.ComponentModel.CancelEventArgs e) { Point point = galleryControl1.PointToClient(Control.MousePosition); RibbonHitInfo hitInfo = galleryControl1.CalcHitInfo(point); if (hitInfo.InGalleryItem || hitInfo.HitTest == RibbonHitTest.GalleryImage) { item = hitInfo.GalleryItem; } if (item == null) { e.Cancel = true; } else { string status_item = item.Value.ToString(); status_item = Data.GetData($"SELECT DISTINCT CASE when b.maban>0 THEN 'True' ELSE 'False' END as sudung from view_ban a LEFT JOIN (SELECT maban from tbl_hoadon where dathanhtoan=0) b on b.maban=a.maban where a.maban='{status_item}'"); bool trangthai = status_item.Equals("False") ? false : true; AnHienMenu(trangthai); } }
private void OnTargetGalleryDragDrop(object sender, DragEventArgs e) { if (!(e.Data.GetDataPresent(typeof(GalleryItem)))) { return; } GalleryItem draggedItem = e.Data.GetData(typeof(GalleryItem)) as GalleryItem; GalleryControl galControl = (GalleryControl)sender; RibbonHitInfo hitInfo = galControl.CalcHitInfo(galControl.PointToClient(new Point(e.X, e.Y))); if (hitInfo.InGalleryGroup) { hitInfo.GalleryItemGroup.Items.Add((GalleryItem)draggedItem.Clone()); } else { int groupIndex = galControl.Gallery.Groups.Add(new GalleryItemGroup()); galControl.Gallery.Groups[groupIndex].Caption = draggedItem.GalleryGroup.Caption; galControl.Gallery.Groups[groupIndex].Items.Add((GalleryItem)draggedItem.Clone()); } }
/// <summary> /// 作用:鼠标在RibbonControl控件上移动时触发的事件 /// 作者:汪建龙 /// 编写时间:2016年12月19日12:56:44 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void ribbonControl_MouseMove(object sender, MouseEventArgs e) { try { RibbonControl ribbonControl = sender as RibbonControl; if (ribbonControl == null || e == null) { return; } RibbonHitInfo hitInfo = ribbonControl.CalcHitInfo(new System.Drawing.Point(e.X, e.Y)); if (hitInfo.InItem) { BarButtonItem item = hitInfo.Item.Item as BarButtonItem; if (item != null && item.Tag is IUICommand) { item.Hint = (item.Tag as IUICommand).Tooltip; } } }catch (Exception ex) { //LogManager.Log.LogError(ex.ToString()); } }
private void OnGalleryControlDragDrop(object sender, DragEventArgs e) { if (!e.Data.GetDataPresent(typeof(List <GalleryItem>)) || DragSource == null) { return; } GalleryControl dragTarget = (GalleryControl)sender; RibbonHitInfo hitInfo = dragTarget.CalcHitInfo(dragTarget.PointToClient(new Point(e.X, e.Y))); GalleryItem targetItem = hitInfo.GalleryItem; if (targetItem != null) { GalleryItemCollection target = targetItem.GalleryGroup.Items; int index = target.IndexOf(targetItem); List <GalleryItem> draggedItems = (List <GalleryItem>)e.Data.GetData(typeof(List <GalleryItem>)); foreach (GalleryItem item in draggedItems) { GalleryItemCollection source = item.GalleryGroup.Items; source.Remove(item); target.Insert(index++, item); } } targetHighlightItem = null; }
private void galleryControl_Click(object sender, EventArgs e) { Point point = galleryControl.PointToClient(Control.MousePosition); RibbonHitInfo hitInfo = galleryControl.CalcHitInfo(point); if (hitInfo.InGalleryItem || hitInfo.HitTest == RibbonHitTest.GalleryImage) { item = hitInfo.GalleryItem; var list = db.GOIMONs.Where(m => m.HOADON.MaBan == item.Value.ToString()).ToList(); if (list.Count > 0) { btnTinhTien.Enabled = true; btnInHoaDon.Enabled = true; } else { btnTinhTien.Enabled = false; btnInHoaDon.Enabled = false; } float TongTien = 0; string id = item.Value.ToString(); var list_ = db.GOIMONs.Where(m => m.HOADON.MaBan == id).ToList(); foreach (float tien in list_.Select(m => m.ThanhTien)) { TongTien = TongTien + tien; } if (TongTien == 0) { txtTongTien.Text = String.Format("{0} VNĐ", TongTien); } else { txtTongTien.Text = String.Format("{0:#,###} VNĐ", TongTien); } } }
private void OnTargetGalleryMouseDown(object sender, MouseEventArgs e) { this.Recycle.AllowDrop = true; GalleryControl galControl = (GalleryControl)sender; RibbonHitInfo hitInfo = galControl.CalcHitInfo(e.Location); if (hitInfo.InGalleryItem) { dragItemHitInfo = hitInfo; return; } dragItemHitInfo = null; }