Exemplo n.º 1
0
        private void layoutView_MouseDown(object sender, MouseEventArgs e)
        {
            var view             = (DevExpress.XtraGrid.Views.Layout.LayoutView)sender;
            LayoutViewHitInfo hi = view.CalcHitInfo(new Point(e.X, e.Y));

            _mouseDownTime    = hi.RowHandle >= 0 ? Environment.TickCount : 0;
            _activatedByMouse = true;
        }
Exemplo n.º 2
0
        private void layoutView_MouseMove(object sender, MouseEventArgs e)
        {
            LayoutView view = sender as LayoutView;

            LayoutViewHitInfo info = view.CalcHitInfo(new Point(e.X, e.Y));

            HoverCard = info.HitCard;
        }
        public override void DoClickAction(BaseHitInfo hitInfo)
        {
            base.DoClickAction(hitInfo);
            LayoutViewCustomButton currentView    = View as LayoutViewCustomButton;
            LayoutViewHitInfo      currentHitInfo = hitInfo as LayoutViewHitInfo;

            currentView.ButtonsCollection.CheckForCustomButtonClick((int)currentHitInfo.HitTest);
        }
Exemplo n.º 4
0
 protected void editOrderlayoutView_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         LayoutViewHitInfo hi = editOrderlayoutView.CalcHitInfo(e.Location);
         if (hi.InCard)
         {
             HideDetail(hi.RowHandle);
         }
     }
 }
Exemplo n.º 5
0
        private void gridControl1_DragDrop(object sender, DragEventArgs e)
        {
            GridControl       grid        = sender as GridControl;
            LayoutView        view        = grid.MainView as LayoutView;
            LayoutViewHitInfo downHitInfo = e.Data.GetData(typeof(LayoutViewHitInfo)) as LayoutViewHitInfo;
            LayoutViewHitInfo hitInfo     = view.CalcHitInfo(grid.PointToClient(new Point(e.X, e.Y)));
            int sourceRow = downHitInfo.RowHandle;
            int targetRow = hitInfo.RowHandle;

            MoveRow(sourceRow, targetRow);
        }
Exemplo n.º 6
0
 private void layoutView1_MouseDown(object sender, MouseEventArgs e) {
     if(e.Clicks == 2 && e.Button == MouseButtons.Left) {
         LayoutViewHitInfo info = layoutView1.CalcHitInfo(e.Location);
         if(info.InCard) {
             Contact current = layoutView1.GetRow(info.RowHandle) as Contact;
             if(current != null) {
                 EditContact(current);
                 layoutView1.UpdateCurrentRow();
             }
         }
     }
 }
Exemplo n.º 7
0
        private void view_MouseDown(object sender, MouseEventArgs e)
        {
            // Für CardView und LayoutView gibt es leider kein GridMenu-Event.
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            bool showMenu = false;

            if (_view is CardView)
            {
                CardHitInfo hi = (_view as CardView).CalcHitInfo(e.Location);
                showMenu = (hi.InCard);
            }
            else if (_view is LayoutView)
            {
                LayoutViewHitInfo hi = (_view as LayoutView).CalcHitInfo(e.Location);
                showMenu = (hi.InCard);
            }
            if (!showMenu)
            {
                return;
            }

            var dxMenu = new DXPopupMenu();

            createMenuItems(dxMenu);

            GridControl gc = _view.GridControl;

            MenuManagerHelper.ShowMenu(dxMenu, gc.LookAndFeel, null, gc, e.Location);


            ////             LayoutViewHitInfo hi = -.CalcHitInfo(GridControl1.PointToClient(p))
            ////        }
            ////        dxMenu.Items.Add(New DXMenuItem("Item1"))
            ////        dxMenu.Items.Add(New DXMenuItem("Item2"))
            ////        Dim p As Point = Control.MousePosition
            ////        Dim view As LayoutView = CType(sender, LayoutView)
            ////        Dim hi As LayoutViewHitInfo = view.CalcHitInfo(GridControl1.PointToClient(p))
            ////        If hi.HitTest = LayoutViewHitTest.CardCaption Then
            ////            MenuManagerHelper.ShowMenu(dxMenu, GridControl1.LookAndFeel, GridControl1, Nothing,
            ////GridControl1.PointToClient(p))
            ////        End If
            ////    End Sub
        }
Exemplo n.º 8
0
        private void gridControl1_DragOver(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.None;

            LayoutViewHitInfo downHitInfo = e.Data.GetData(typeof(LayoutViewHitInfo)) as LayoutViewHitInfo;

            if (downHitInfo != null)
            {
                GridControl       grid    = sender as GridControl;
                LayoutView        view    = grid.MainView as LayoutView;
                LayoutViewHitInfo hitInfo = view.CalcHitInfo(grid.PointToClient(new Point(e.X, e.Y)));
                if (hitInfo.InCard && hitInfo.RowHandle != downHitInfo.RowHandle)
                {
                    e.Effect = DragDropEffects.Move;
                }
            }
        }
Exemplo n.º 9
0
        private void layoutView1_MouseMove(object sender, MouseEventArgs e)
        {
            LayoutView view = sender as LayoutView;

            if (e.Button == MouseButtons.Left && downHitInfo != null)
            {
                Size      dragSize = SystemInformation.DragSize;
                Rectangle dragRect = new Rectangle(new Point(downHitInfo.HitPoint.X - dragSize.Width / 2,
                                                             downHitInfo.HitPoint.Y - dragSize.Height / 2), dragSize);

                if (!dragRect.Contains(new Point(e.X, e.Y)))
                {
                    view.GridControl.DoDragDrop(downHitInfo, DragDropEffects.All);
                    downHitInfo = null;
                }
            }
        }
Exemplo n.º 10
0
        public override LayoutViewHitInfo CalcHitInfo(Point pt)
        {
            LayoutViewHitInfo      returnedValue = base.CalcHitInfo(pt);
            LayoutViewCustomButton CurrentView   = Owner as LayoutViewCustomButton;

            if (CurrentView != null)
            {
                for (int i = 1; i <= CurrentView.ButtonsCollection.Count; i++)
                {
                    if (CurrentView.ButtonsCollection[i - 1].Bounds.Contains(pt))
                    {
                        returnedValue.HitTest = (LayoutViewHitTest)CurrentView.ButtonsCollection[i - 1].GetHashCode();
                        returnedValue.HitRect = CurrentView.ButtonsCollection[i - 1].Bounds;
                    }
                }
            }
            return(returnedValue);
        }
Exemplo n.º 11
0
        private void layoutView1_MouseDown(object sender, MouseEventArgs e)
        {
            LayoutView view = sender as LayoutView;

            downHitInfo = null;

            LayoutViewHitInfo hitInfo = view.CalcHitInfo(new Point(e.X, e.Y));

            if (Control.ModifierKeys != Keys.None)
            {
                return;
            }
            if (e.Button == MouseButtons.Left && hitInfo.InCard)
            {
                downHitInfo = hitInfo;
            }
            GetPicture();
        }
Exemplo n.º 12
0
 protected virtual void ProcessMouseClick(EventArgs e)
 {
     if (!_selectedItemExecuting)
     {
         if (ColumnView.FocusedRowHandle >= 0)
         {
             DXMouseEventArgs  args    = DXMouseEventArgs.GetMouseArgs(Grid, e);
             LayoutViewHitInfo hitInfo = XafLayoutView.CalcHitInfo(args.Location);
             if (hitInfo.InCard &&
                 (hitInfo.HitTest == LayoutViewHitTest.FieldCaption ||
                  hitInfo.HitTest == LayoutViewHitTest.CardCaption ||
                  hitInfo.HitTest == LayoutViewHitTest.Field ||
                  hitInfo.HitTest == LayoutViewHitTest.FieldValue ||
                  hitInfo.HitTest == LayoutViewHitTest.LayoutItem)
                 )
             {
                 args.Handled = true;
                 OnProcessSelectedItem();
             }
         }
     }
 }
Exemplo n.º 13
0
        private void layoutView1_MouseMove(object sender, MouseEventArgs e)
        {
            LayoutViewHitInfo hitInfo = layoutView1.CalcHitInfo(e.Location);

            if (layoutView1.FocusedRowHandle != hitInfo.RowHandle && layoutView1.FocusedColumn != hitInfo.Column)
            {
                return;
            }
            if (hitInfo.InCard)
            {
                if (hitInfo.Column != null)
                {
                    if (hitInfo.Column.FieldName == "UnboundKomentar")
                    {
                        layoutView1.FocusedRowHandle = hitInfo.RowHandle;
                        layoutView1.FocusedColumn    = hitInfo.Column;
                        layoutView1.ShowEditor();

                        //bool a = false; bool b = false;
                        //if (layoutView1.FocusedRowHandle != hitInfo.RowHandle)
                        //{
                        //    layoutView1.FocusedRowHandle = hitInfo.RowHandle;
                        //    a = true;
                        //}
                        //if (layoutView1.FocusedColumn != hitInfo.Column)
                        //{
                        //    layoutView1.FocusedColumn = hitInfo.Column;
                        //    b = true;
                        //}
                        //if (a || b) layoutView1.ShowEditor();
                    }
                    else
                    {
                        layoutView1.HideEditor(); xtraScrollableControl1.Focus();
                    }
                }
            }
        }