Beispiel #1
0
        private void ultraGrid1_DragOver(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.Move;
            UltraGrid grid = sender as UltraGrid;
            // Get the position on the grid where the dragged row(s) are to be dropped.
            //get the grid coordinates of the row (the drop zone)
            UIElement uieOver = ultraGrid1.DisplayLayout.UIElement.ElementFromPoint(ultraGrid1.PointToClient(new Point(e.X, e.Y)));

            //get the row that is the drop zone/or where the dragged row is to be dropped
            UltraGridRow ugrOver = uieOver.GetContext(typeof(UltraGridRow), true) as UltraGridRow;

            if (!Regex.IsMatch(ugrOver.Band.Key, "Type"))//parent row
            {
                ugrOver.Expanded = true;
            }

            Point pointInGridCoords = grid.PointToClient(new Point(e.X, e.Y));

            if (pointInGridCoords.Y < 20)
            {
                // Scroll up.
                this.ultraGrid1.ActiveRowScrollRegion.Scroll(RowScrollAction.LineUp);
            }
            else if (pointInGridCoords.Y > grid.Height - 20)
            {
                // Scroll down.
                this.ultraGrid1.ActiveRowScrollRegion.Scroll(RowScrollAction.LineDown);
            }
        }
Beispiel #2
0
        private void grdData_DragOver(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.Move;
            UltraGrid grid = sender as UltraGrid;
            Point     pointInGridCoords = grid.PointToClient(new Point(e.X, e.Y));

            if (pointInGridCoords.Y < 20)
            {
                // Scroll up.
                this.grdData.ActiveRowScrollRegion.Scroll(RowScrollAction.LineUp);
            }
            else if (pointInGridCoords.Y > grid.Height - 20)
            {
                // Scroll down.
                this.grdData.ActiveRowScrollRegion.Scroll(RowScrollAction.LineDown);
            }
        }
Beispiel #3
0
 void ugSimulationgropus_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
 {
     if (isDragInternal)
     {
         e.Effect = DragDropEffects.Move;
         UltraGrid grid = sender as UltraGrid;
         Point     pointInGridCoords = grid.PointToClient(new Point(e.X, e.Y));
         if (pointInGridCoords.Y < 20)
         {
             // Scroll up.
             this.ugSimulationgropus.ActiveRowScrollRegion.Scroll(RowScrollAction.LineUp);
         }
         else if (pointInGridCoords.Y > grid.Height - 20)
         {
             // Scroll down.
             this.ugSimulationgropus.ActiveRowScrollRegion.Scroll(RowScrollAction.LineDown);
         }
     }
 }
Beispiel #4
0
        private void uGrid_Master_DoubleClick(object sender, EventArgs e)
        {
            ToolClickEventArgs eTool;
            ToolBase           utb;

            try
            {
                if (MsgInfoReturned.IntMaxRow != 1 || FormQueryMode != YRQueryType.NA)
                {
                    return;
                }

                //Cast the sender into an UltraGrid
                UltraGrid grid = sender as UltraGrid;

                //Get the last element that the mouse entered
                UIElement lastElementEntered = grid.DisplayLayout.UIElement.LastElementEntered;

                //See if there's a RowUIElement in the chain.
                RowUIElement rowElement;
                if (lastElementEntered is RowUIElement)
                {
                    rowElement = (RowUIElement)lastElementEntered;
                }
                else
                {
                    rowElement = (RowUIElement)lastElementEntered.GetAncestor(typeof(RowUIElement));
                }

                if (rowElement == null)
                {
                    return;
                }

                //Try to get a row from the element
                UltraGridRow row = (UltraGridRow)rowElement.GetContext(typeof(UltraGridRow));

                //If no row was returned, then the mouse is not over a row.
                if (row == null)
                {
                    return;
                }

                //The mouse is over a row.

                //This part is optional, but if the user double-clicks the line
                //between Row selectors, the row is AutoSized by
                //default. In that case, we probably don't want to do
                //the double-click code.

                //Get the current mouse pointer location and convert it
                //to grid coords.
                Point MousePosition = grid.PointToClient(Control.MousePosition);
                //See if the Point is on an AdjustableElement - meaning that
                //the user is clicking the line on the row selector
                if (lastElementEntered.AdjustableElementFromPoint(MousePosition) != null)
                {
                    return;
                }

                //取回資料
                utb   = UtbmMain.Tools["BtOk"];
                eTool = new ToolClickEventArgs(utb, null);
                UtbmMain_ToolClick(UtbmMain, eTool);
            }
            catch (Exception ex)
            {
                WfShowErrorMsg(ex.ToString());
            }
        }